Commit 2a8fd16fb02cc59ef6e4317827daae33bfc4f0e6

Authored by taiyuan
1 parent 90864bdf

服务卡项详情

packageA/pages/cardDetails/cardDetails.js
1 // pages/i_service/cardDetails/cardDetails.js 1 // pages/i_service/cardDetails/cardDetails.js
  2 +const app = getApp();
  3 +let self = null;
  4 +
2 Page({ 5 Page({
3 6
4 /** 7 /**
5 * 页面的初始数据 8 * 页面的初始数据
6 */ 9 */
7 data: { 10 data: {
8 -  
9 }, 11 },
10 12
11 /** 13 /**
12 * 生命周期函数--监听页面加载 14 * 生命周期函数--监听页面加载
13 */ 15 */
14 onLoad: function (options) { 16 onLoad: function (options) {
15 - 17 + self = this;
  18 + this.data.options = options;
  19 + // this.setData({
  20 + // options,
  21 + // });
  22 + app.isLogin().then(function(data) {//进入页面前已经授权登录成功
  23 + self.setData({
  24 + userInfo: data,
  25 + imghost: app.globalData.setting.imghost,
  26 + });
  27 + });
  28 +
16 }, 29 },
17 30
18 /** 31 /**
@@ -26,7 +39,26 @@ Page({ @@ -26,7 +39,26 @@ Page({
26 * 生命周期函数--监听页面显示 39 * 生命周期函数--监听页面显示
27 */ 40 */
28 onShow: function () { 41 onShow: function () {
29 - 42 + if(app.globalData.userInfo) {
  43 + if(!this.data.isLogin) {
  44 + this.setData({
  45 + userInfo: app.globalData.userInfo,
  46 + imghost: app.globalData.setting.imghost,
  47 + isLogin: true,
  48 + });
  49 +
  50 + app.request.get("/api/weshop/serviceCard/get/" + app.globalData.setting.stoid + '/' + this.data.options.id, {
  51 + isShowLoading: false,
  52 + success: function(res) {
  53 + self.setData({
  54 + details: res.data.data
  55 + });
  56 + },
  57 + });
  58 +
  59 +
  60 + };
  61 + };
30 }, 62 },
31 63
32 /** 64 /**
packageA/pages/cardDetails/cardDetails.wxml
1 <view class="page"> 1 <view class="page">
2 <view> 2 <view>
3 - <image class="image" src=""/> 3 + <image class="image" src="{{imghost + details.imgUrl}}" mode="aspectFit"/>
4 </view> 4 </view>
5 <view class="bg-white"> 5 <view class="bg-white">
6 - <view class="price pd20 fs30">3000</view>  
7 - <view class="fs28 pdh20"><text class="ellipsis-2 lh1-4">服务卡项名称服务卡项名称服务卡项名称服务卡称服务卡项名称服务卡称服务卡项名称服务卡称服务卡项名称服务卡项名称服务卡项名称服务卡项名称服务卡项名称</text></view> 6 + <view class="price pd20 fs30">{{details.money}}</view>
  7 + <view class="fs28 pdh20"><text class="ellipsis-2 lh1-4">{{details.serviceName}}</text></view>
8 <view class="flex jc_sb fs24 pdh20 pdv30 c7b"> 8 <view class="flex jc_sb fs24 pdh20 pdv30 c7b">
9 - <view>时长:30分钟</view>  
10 - <view>次数:10次</view>  
11 - <view>有效天数:365天</view> 9 + <!-- <view>时长:30分钟</view>
  10 + <view>次数:10次</view> -->
  11 + <view>有效天数:{{details.validDays}}天</view>
12 </view> 12 </view>
13 </view> 13 </view>
14 <!-- 详情 --> 14 <!-- 详情 -->
15 - <view>  
16 - <view class="t-c pd20 line c7b"><text class="title">详情</text></view>  
17 - <view>  
18 - <images class="image"/>  
19 - </view> 15 + <view class="bg-white">
  16 + <view class="t-c pd20 c7b"><text class="title">—— 详情 ——</text></view>
  17 + <view class="pd20">{{details.serviceContent}}</view>
20 </view> 18 </view>
21 </view> 19 </view>
packageA/pages/cardDetails/cardDetails.wxss
@@ -10,7 +10,6 @@ page { @@ -10,7 +10,6 @@ page {
10 .image { 10 .image {
11 width: 100%; 11 width: 100%;
12 display: block; 12 display: block;
13 - background-color: pink;  
14 } 13 }
15 14
16 .price { 15 .price {
@@ -40,6 +39,5 @@ page { @@ -40,6 +39,5 @@ page {
40 } 39 }
41 40
42 .title { 41 .title {
43 - background-color: #f2f2f2;  
44 padding: 10rpx; 42 padding: 10rpx;
45 } 43 }
46 \ No newline at end of file 44 \ No newline at end of file
packageA/pages/service_share/service_share.js
@@ -857,7 +857,13 @@ Page({ @@ -857,7 +857,13 @@ Page({
857 success:function(){} 857 success:function(){}
858 }) 858 })
859 859
860 - } 860 + },
  861 +
  862 +
  863 + goto:function(e) {
  864 + var url = e.currentTarget.dataset.url;
  865 + app.goto(url);
  866 + },
861 867
862 868
863 }) 869 })
864 \ No newline at end of file 870 \ No newline at end of file
packageA/pages/service_share/service_share.wxml
@@ -35,8 +35,9 @@ @@ -35,8 +35,9 @@
35 bindscrolltolower="refresh" 35 bindscrolltolower="refresh"
36 scroll-anchoring 36 scroll-anchoring
37 > 37 >
38 - <block wx:for="{{list}}">  
39 - <view class class="list-item" bindtap="go_goods" data-index="{{index}}"> 38 + <block wx:for="{{list}}">
  39 + <!-- <view class class="list-item" bindtap="go_goods" data-index="{{index}}"> -->
  40 + <view class class="list-item" bindtap="goto" data-index="{{index}}" data-url="{{'/packageA/pages/cardDetails/cardDetails?id=' + item.id}}">
40 <view class="img-container"> 41 <view class="img-container">
41 <image src="{{url+item.original_img}}" style="width: 100%; height: 100%;" 42 <image src="{{url+item.original_img}}" style="width: 100%; height: 100%;"
42 binderror="bind_bnerr2" lazy-load="true" 43 binderror="bind_bnerr2" lazy-load="true"