Commit 39697eeb7a13bd701f82d181c76637d8ef44d9dd

Authored by yiren
1 parent d6cbfb01

充值和购买代金券页面和接口对接

@@ -98,7 +98,8 @@ @@ -98,7 +98,8 @@
98 "pages/index", 98 "pages/index",
99 "pages/cart", 99 "pages/cart",
100 "pages/success", 100 "pages/success",
101 - "pages/remark" 101 + "pages/remark",
  102 + "pages/index_new"
102 ] 103 ]
103 }, 104 },
104 { 105 {
1 // pack-activity/pack/buyCoupon.js 1 // pack-activity/pack/buyCoupon.js
  2 +import App from '../../utils/api';
  3 +import util from '../../utils/util'
2 Page({ 4 Page({
3 5
4 /** 6 /**
@@ -8,10 +10,14 @@ Page({ @@ -8,10 +10,14 @@ Page({
8 opt: { 10 opt: {
9 name: '', 11 name: '',
10 id:'', 12 id:'',
  13 + oid:'',
  14 + use:{},
  15 + sid:'',
11 }, 16 },
  17 + detail:{},
  18 + exp_date:{},
12 num: 1, 19 num: 1,
13 totalize: '', 20 totalize: '',
14 - money: 20.55,  
15 explain: "关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事", 21 explain: "关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事",
16 }, 22 },
17 23
@@ -23,20 +29,19 @@ Page({ @@ -23,20 +29,19 @@ Page({
23 opt:{ 29 opt:{
24 id:options.id, 30 id:options.id,
25 name:options.name, 31 name:options.name,
  32 + sid:options.sid,
  33 + oid:options.oid,
  34 + use:JSON.parse(options.use)
26 } 35 }
27 }) 36 })
28 - console.log({...this.data.opt}); 37 + console.log('onLoad',{...this.data.opt});
29 }, 38 },
30 39
31 /** 40 /**
32 * 生命周期函数--监听页面初次渲染完成 41 * 生命周期函数--监听页面初次渲染完成
33 */ 42 */
34 onReady() { 43 onReady() {
35 - let money = this.data.money * 1;  
36 - let num = this.data.num * 1;  
37 - this.setData({  
38 - totalize: (money * num).toFixed(2)  
39 - }) 44 + this.getDetail();
40 }, 45 },
41 46
42 /** 47 /**
@@ -45,9 +50,29 @@ Page({ @@ -45,9 +50,29 @@ Page({
45 onShow() { 50 onShow() {
46 51
47 }, 52 },
  53 + getDetail(){
  54 + App.Activity.GetActivityById({
  55 + id: this.data.opt.id
  56 + }).then(res => {
  57 + if(res.data.length>0){
  58 + let detail=res.data[0];
  59 + let exp_date=detail.exp_date?JSON.parse(detail.exp_date):'';
  60 + let price = detail.price * 1;
  61 + let num = this.data.num * 1;
  62 + this.setData({
  63 + detail,
  64 + exp_date,
  65 + totalize: (price * num).toFixed(2)
  66 + })
  67 + console.log('detail',{...detail});
  68 + console.log('exp_date',{...exp_date});
  69 + console.log('totalize',this.data.totalize);
  70 + }
  71 + })
  72 + },
48 // 点击减号 73 // 点击减号
49 subtraction() { 74 subtraction() {
50 - let money = this.data.money * 1; 75 + let price = this.data.detail.price * 1;
51 let num = this.data.num * 1; 76 let num = this.data.num * 1;
52 let num1 = num - 1 77 let num1 = num - 1
53 if (num == '1') { 78 if (num == '1') {
@@ -55,23 +80,44 @@ Page({ @@ -55,23 +80,44 @@ Page({
55 } 80 }
56 this.setData({ 81 this.setData({
57 num: num1, 82 num: num1,
58 - totalize: (money * num1).toFixed(2) 83 + totalize: (price * num1).toFixed(2)
59 }) 84 })
60 }, 85 },
61 // 点击加号 86 // 点击加号
62 addition() { 87 addition() {
63 - let money = this.data.money * 1; 88 + let price = this.data.detail.price * 1;
64 let num = this.data.num * 1; 89 let num = this.data.num * 1;
65 let num1 = num + 1 90 let num1 = num + 1
66 this.setData({ 91 this.setData({
67 num: num1, 92 num: num1,
68 - totalize: (money * num1).toFixed(2) 93 + totalize: (price * num1).toFixed(2)
69 }) 94 })
70 }, 95 },
71 // 提交订单 96 // 提交订单
72 submitOrder() { 97 submitOrder() {
73 - wx.navigateTo({  
74 - url: '/pack-activity/pack/confirmPayment', 98 + console.log('oidoid',this.data.opt.oid);
  99 + let detail=this.data.detail
  100 + detail.name=this.data.opt.name;
  101 + detail.oid=this.data.opt.oid;
  102 + App.Activity.CreateNewRechargeOrder({
  103 + recharge_id:this.data.opt.id,
  104 + sellerid:this.data.opt.sid,
  105 + number:this.data.num,
  106 + price:this.data.totalize,
  107 + type:'1',
  108 + }).then(res=>{
  109 + console.log(res);
  110 + if(res.ret=='200'){
  111 + wx.navigateTo({
  112 + url: `./confirmPayment?type=1&detail=${JSON.stringify(detail)}&orderId=${res.data.id}&totalize=${this.data.totalize}`,
  113 + })
  114 + }else{
  115 + wx.showToast({
  116 + title:res.msg,
  117 + duration:2000,
  118 + mask:true
  119 + })
  120 + }
75 }) 121 })
76 }, 122 },
77 /** 123 /**
1 <!--pack-activity/pack/buyCoupon.wxml 代金券抢购页面--> 1 <!--pack-activity/pack/buyCoupon.wxml 代金券抢购页面-->
  2 +<wxs src="../../utils/util.wxs" module="util" />
2 <nav>{{opt.name}}</nav> 3 <nav>{{opt.name}}</nav>
3 <view class="wrap"> 4 <view class="wrap">
4 <view class="info info1"> 5 <view class="info info1">
5 <view class="info_left font38r"> 6 <view class="info_left font38r">
6 - 200元代金券 7 + {{detail.aname}}
7 </view> 8 </view>
8 <view class="info_right"> 9 <view class="info_right">
9 - <view class="preferential font32r"><text class="font32r">200元/</text>{{money}}元</view> 10 + <view class="preferential font32r">
  11 + <text wx:if="{{use.cash && (use.is_cash=='1' || use.is_cash)}}" class="font32r">{{use.cash}}元/</text>
  12 + {{detail.price}}元
  13 + </view>
10 <view class="operation"> 14 <view class="operation">
11 <text class="font30r" bindtap="subtraction">-</text> 15 <text class="font30r" bindtap="subtraction">-</text>
12 <input type="number" model:value="{{num}}" /> 16 <input type="number" model:value="{{num}}" />
@@ -19,7 +23,7 @@ @@ -19,7 +23,7 @@
19 券要求 23 券要求
20 </view> 24 </view>
21 <view class="info_right text_info font32r"> 25 <view class="info_right text_info font32r">
22 - 满200可用 26 + {{detail.desc}}
23 </view> 27 </view>
24 </view> 28 </view>
25 <view class="info"> 29 <view class="info">
@@ -27,7 +31,7 @@ @@ -27,7 +31,7 @@
27 有效期从 31 有效期从
28 </view> 32 </view>
29 <view class="info_right text_info font32r"> 33 <view class="info_right text_info font32r">
30 - 2023-04-28 34 + {{util.unixtoTime(detail.stime,'YYYY-MM-DD')}}
31 </view> 35 </view>
32 </view> 36 </view>
33 <view class="info"> 37 <view class="info">
@@ -35,23 +39,29 @@ @@ -35,23 +39,29 @@
35 有效期至 39 有效期至
36 </view> 40 </view>
37 <view class="info_right text_info font32r"> 41 <view class="info_right text_info font32r">
38 - 2023-08-28 42 + {{util.unixtoTime(detail.etime,'YYYY-MM-DD')}}
39 </view> 43 </view>
40 </view> 44 </view>
41 <view class="info"> 45 <view class="info">
42 <view class="info_left font32r"> 46 <view class="info_left font32r">
43 使用限制: 47 使用限制:
44 </view> 48 </view>
45 - <view class="info_right text_info font32r"> 49 + <view wx:if="{{exp_date.is_week=='1' || exp_date.is_week*1}}" class="info_right text_info font32r" >
  50 + {{exp_date.week_show?exp_date.week_show+'可用':''}}
  51 + </view>
  52 + <view wx:if="{{exp_date.is_none=='1' || exp_date.is_none*1}}" class="info_right text_info font32r" >
46 无限制 53 无限制
47 </view> 54 </view>
  55 + <view wx:if="{{exp_date.is_birthday=='1' || exp_date.is_birthday*1}}" class="info_right text_info font32r" >
  56 + 生日当天可用
  57 + </view>
48 </view> 58 </view>
49 <view class="info"> 59 <view class="info">
50 <view class="info_left font32r"> 60 <view class="info_left font32r">
51 券说明 61 券说明
52 </view> 62 </view>
53 </view> 63 </view>
54 - <view class="explain_news">{{explain}}</view> 64 + <view class="explain_news">{{detail.explain}}</view>
55 </view> 65 </view>
56 <view class="fixed_box"> 66 <view class="fixed_box">
57 <view class="shoppingCart_img"> 67 <view class="shoppingCart_img">
1 // pack-activity/pack/confirmPayment.js 1 // pack-activity/pack/confirmPayment.js
2 -import util from '../../utils/util' 2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
3 Page({ 4 Page({
4 5
5 /** 6 /**
6 * 页面的初始数据 7 * 页面的初始数据
7 */ 8 */
8 data: { 9 data: {
9 - type: '2', 10 + opt:{
  11 + detail:{},
  12 + orderId:'',
  13 + totalize:'',
  14 + },
  15 + type: '',
  16 + price:'',
10 detail:{}, 17 detail:{},
11 - time: 1800, 18 + time: 300,
12 countdown: '', 19 countdown: '',
13 tip: '', 20 tip: '',
14 date: "", 21 date: "",
15 - type: '2',  
16 }, 22 },
17 23
18 /** 24 /**
@@ -21,39 +27,84 @@ Page({ @@ -21,39 +27,84 @@ Page({
21 onLoad(options) { 27 onLoad(options) {
22 this.setData({ 28 this.setData({
23 opt:{ 29 opt:{
24 - type:options.type,  
25 - detail:JSON.parse(options.detail),  
26 - } 30 + detail:options.detail?JSON.parse(options.detail):'',
  31 + orderId:options.orderId,
  32 + totalize:options.totalize?options.totalize:''
  33 + },
  34 + type:options.type
27 }) 35 })
28 - console.log('options.detail',JSON.parse(options.detail)); 36 + console.log('onLoad',{...this.data.opt});
29 this.countdown() 37 this.countdown()
30 this.modal = this.selectComponent("#payModal"); //通过给组件所起的id调用组件 38 this.modal = this.selectComponent("#payModal"); //通过给组件所起的id调用组件
31 }, 39 },
32 showModal() { 40 showModal() {
33 this.modal.showModal() //调用组件中打开模态框方法 41 this.modal.showModal() //调用组件中打开模态框方法
34 }, 42 },
  43 + recharge(){
  44 + console.log('11111111111111111',this.data.opt.detail.oid);
  45 + this.closeModal()
  46 + wx.reLaunch({
  47 + url: `/miniprogram/pages/customer/detail_owner_invitation_new.wxml?id=${this.data.opt.detail.oid}&hasInvitation=1&hasSellerShare=1&tplid=1`
  48 + })
  49 + },
  50 + certificate(){
  51 + console.log('11111111111111111',this.data.opt.detail.oid);
  52 + this.closeModal()
  53 + wx.reLaunch({
  54 + url: '/miniprogram/pages/me/coupon_news'
  55 + })
  56 + },
35 confirmPayment(){ 57 confirmPayment(){
  58 + console.log(11111);
  59 + App.PayOnline.CombineTransactionsByRecharge({
  60 + id:this.data.opt.orderId
  61 + }).then(res=>{
  62 + console.log(res.ret);
  63 + if(res.ret=='200'){
  64 + console.log(res.ret);
  65 + this.setData({
  66 + price:res.data.price
  67 + })
  68 + wx.requestPayment({
  69 + timeStamp: res.data.timeStamp+'',
  70 + nonceStr: res.data.nonceStr,
  71 + package: res.data.package,
  72 + signType: res.data.signType,
  73 + paySign: res.data.paySign,
  74 + success (ress) {
  75 + this.showModal()
  76 + },
  77 + fail (ress) {
  78 + console.log(ress);
  79 + }
  80 + })
  81 + }
  82 + })
  83 +
36 }, 84 },
37 closeModal() { 85 closeModal() {
38 this.modal.closeModal() //调用组件中关闭模态框方法 86 this.modal.closeModal() //调用组件中关闭模态框方法
39 }, 87 },
40 // 充值————点击确认支付 88 // 充值————点击确认支付
41 formSubmit(e) { 89 formSubmit(e) {
42 - let form=e.detail.value  
43 - console.log('form',form);  
44 - if (!form.name) {  
45 - util.toast('未填写姓名', 'none')  
46 - return;  
47 - }  
48 - if (!form.phone) {  
49 - util.toast('未填写手机号码', 'none')  
50 - return;  
51 - }  
52 - if (!/^1\d{10}$/.test(form.phone)) {  
53 - util.toast('手机号码错误', 'none')  
54 - return; 90 + console.log(this.data.type);
  91 + if(this.data.type=='2'){
  92 + let form=e.detail.value
  93 + if (!form.name) {
  94 + util.toast('未填写姓名', 'none')
  95 + return;
  96 + }
  97 + if (!form.phone) {
  98 + util.toast('未填写手机号码', 'none')
  99 + return;
  100 + }
  101 + if (!/^1\d{10}$/.test(form.phone)) {
  102 + util.toast('手机号码错误', 'none')
  103 + return;
  104 + }
55 } 105 }
56 - this.confirmPayment() 106 + console.log(1111);
  107 + this.confirmPayment()
57 }, 108 },
58 // 选择日期 109 // 选择日期
59 bind_ChangeDate(event) { 110 bind_ChangeDate(event) {
@@ -87,22 +138,6 @@ Page({ @@ -87,22 +138,6 @@ Page({
87 }) 138 })
88 setTimeout(this.countdown, 1000); 139 setTimeout(this.countdown, 1000);
89 }, 140 },
90 - // 支付  
91 - confirmPayment() {  
92 - // wx.requestPayment({  
93 - // timeStamp: '',  
94 - // nonceStr: '',  
95 - // package: '',  
96 - // signType: 'MD5',  
97 - // paySign: '',  
98 - // success (res) {  
99 -  
100 - // },  
101 - // fail (res) {  
102 -  
103 - // }  
104 - // })  
105 - },  
106 /** 141 /**
107 * 生命周期函数--监听页面隐藏 142 * 生命周期函数--监听页面隐藏
108 */ 143 */
@@ -6,13 +6,13 @@ @@ -6,13 +6,13 @@
6 支付剩余时间 {{countdown}} 6 支付剩余时间 {{countdown}}
7 </view> 7 </view>
8 <view class="money_text"> 8 <view class="money_text">
9 - ¥50.00 9 + {{opt.detail.aname}}
10 </view> 10 </view>
11 <view class="nameText font24r"> 11 <view class="nameText font24r">
12 - 200元代金券 12 + {{opt.detail.totalize}}
13 </view> 13 </view>
14 <view class="nameText font24r"> 14 <view class="nameText font24r">
15 - 唐人街1号中餐厅 15 + {{opt.detail.name}}
16 </view> 16 </view>
17 </view> 17 </view>
18 <view wx:if="{{type=='2'}}" class="coupon"> 18 <view wx:if="{{type=='2'}}" class="coupon">
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <view class="page-section"> 26 <view class="page-section">
27 <view class="page-section-title font32r">联系电话</view> 27 <view class="page-section-title font32r">联系电话</view>
28 <view class="weui-cells weui-cell__bd" style="margin: 30rpx 0"> 28 <view class="weui-cells weui-cell__bd" style="margin: 30rpx 0">
29 - <input class="weui-input" type="number" name="phone" maxlength="11" placeholder="点击输入您的电话" placeholder-style="color:#999;" style="color: #999"/> 29 + <input class="weui-input" type="number" name="phone" maxlength="11" placeholder="点击输入您的电话" placeholder-style="color:#999;" style="color: #999" />
30 </view> 30 </view>
31 </view> 31 </view>
32 <view class="page-section page-section1"> 32 <view class="page-section page-section1">
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <view class="colorSty">{{date?date:'点击输入您的生日'}}</view> 36 <view class="colorSty">{{date?date:'点击输入您的生日'}}</view>
37 </picker> 37 </picker>
38 </view> 38 </view>
39 - <view class="more"></view> 39 + <view class="more"></view>
40 </view> 40 </view>
41 <view class="page-section"> 41 <view class="page-section">
42 <view class="page-section-title font32r">充值金额</view> 42 <view class="page-section-title font32r">充值金额</view>
@@ -44,22 +44,26 @@ @@ -44,22 +44,26 @@
44 {{opt.detail.recharge_money}}元 44 {{opt.detail.recharge_money}}元
45 </view> 45 </view>
46 </view> 46 </view>
47 - <view class="fixed_box">  
48 - <button class="font32r btns" formType="submit">确认支付  
49 - </button>  
50 - </view>  
51 </form> 47 </form>
52 </view> 48 </view>
53 </view> 49 </view>
  50 +<view wx:if="{{type=='2'}}" class="fixed_box">
  51 + <button class="font32r btns" formType="submit">确认支付
  52 + </button>
  53 +</view>
  54 +<view wx:if="{{type=='1'}}" class="fixed_box">
  55 + <button class="font32r btns" bindtap="formSubmit">确认支付
  56 + </button>
  57 +</view>
54 <my-modal id="payModal" fadeStyle="slideUp" height="380px"> 58 <my-modal id="payModal" fadeStyle="slideUp" height="380px">
55 - <view slot="modalName" class="titleModal">成功支付50.00元</view> 59 + <view slot="modalName" class="titleModal">成功支付{{price}}元</view>
56 <view slot="modalContent"> 60 <view slot="modalContent">
57 <view class="explain" wx:if="{{type=='2'}}"> 61 <view class="explain" wx:if="{{type=='2'}}">
58 您的会员充值已经在办理中,到店消费时请和收银核实,谢谢! 62 您的会员充值已经在办理中,到店消费时请和收银核实,谢谢!
59 </view> 63 </view>
60 - <button wx:if="{{type=='2'}}" class="font32r btnsPay" bindtap="closeModal">完成 64 + <button wx:if="{{type=='2'}}" class="font32r btnsPay" bindtap="recharge">完成
61 </button> 65 </button>
62 - <button wx:else class="font32r btnsPay" bindtap="closeModal">朕知道了 66 + <button wx:else class="font32r btnsPay" bindtap="certificate">朕知道了
63 </button> 67 </button>
64 </view> 68 </view>
65 </my-modal> 69 </my-modal>
@@ -10,6 +10,8 @@ Page({ @@ -10,6 +10,8 @@ Page({
10 opt: { 10 opt: {
11 name: '', 11 name: '',
12 id:'', 12 id:'',
  13 + sid:'',
  14 + oid:'',
13 }, 15 },
14 exp_date:{}, 16 exp_date:{},
15 detail:{}, 17 detail:{},
@@ -24,9 +26,11 @@ Page({ @@ -24,9 +26,11 @@ Page({
24 opt:{ 26 opt:{
25 id:options.id, 27 id:options.id,
26 name:options.name, 28 name:options.name,
  29 + sid:options.sid,
  30 + oid:options.oid
27 } 31 }
28 }) 32 })
29 - console.log({...this.data.opt}); 33 + console.log('onLoad',{...this.data.opt});
30 }, 34 },
31 35
32 /** 36 /**
@@ -55,8 +59,8 @@ Page({ @@ -55,8 +59,8 @@ Page({
55 }).then(res => { 59 }).then(res => {
56 let detail=res.data 60 let detail=res.data
57 detail.name=this.data.opt.name 61 detail.name=this.data.opt.name
58 - let exp_date=util.parseDataValue(res.data.exp_date)  
59 - let recharge_list=util.parseDataValue(res.data.recharge_list) 62 + let exp_date=res.data.exp_date?JSON.parse(res.data.exp_date):''
  63 + let recharge_list=res.data.recharge_list?JSON.parse(res.data.recharge_list):''
60 this.setData({ 64 this.setData({
61 detail, 65 detail,
62 exp_date, 66 exp_date,
@@ -73,8 +77,29 @@ Page({ @@ -73,8 +77,29 @@ Page({
73 }) 77 })
74 }, 78 },
75 submitOrder(){ 79 submitOrder(){
76 - wx.navigateTo({  
77 - url: `./confirmPayment?type=2&detail=${JSON.stringify(this.data.detail)}`, 80 + console.log('oidoid',this.data.opt.oid);
  81 + let detail=this.data.detail
  82 + detail.name=this.data.opt.name;
  83 + detail.oid=this.data.opt.oid;
  84 + App.Activity.CreateNewRechargeOrder({
  85 + recharge_id:this.data.opt.id,
  86 + sellerid:this.data.opt.sid,
  87 + number:'1',
  88 + price:this.data.detail.recharge_money,
  89 + type:'2',
  90 + }).then(res=>{
  91 + console.log(res);
  92 + if(res.ret=='200'){
  93 + wx.navigateTo({
  94 + url: `./confirmPayment?type=2&detail=${JSON.stringify(detail)}&orderId=${res.data.id}`,
  95 + })
  96 + }else{
  97 + wx.showToast({
  98 + title:res.msg,
  99 + duration:2000,
  100 + mask:true
  101 + })
  102 + }
78 }) 103 })
79 }, 104 },
80 /** 105 /**
  1 +// pack-activity/pack/buyCoupon.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + opt: {
  9 + name: '',
  10 + id:'',
  11 + },
  12 + num: 1,
  13 + totalize: '',
  14 + money: 20.55,
  15 + explain: "关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事,关于代金券不得不说的那些事",
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面加载
  20 + */
  21 + onLoad(options) {
  22 + this.setData({
  23 + opt:{
  24 + id:options.id,
  25 + name:options.name,
  26 + }
  27 + })
  28 + console.log({...this.data.opt});
  29 + },
  30 +
  31 + /**
  32 + * 生命周期函数--监听页面初次渲染完成
  33 + */
  34 + onReady() {
  35 + let money = this.data.money * 1;
  36 + let num = this.data.num * 1;
  37 + this.setData({
  38 + totalize: (money * num).toFixed(2)
  39 + })
  40 + },
  41 +
  42 + /**
  43 + * 生命周期函数--监听页面显示
  44 + */
  45 + onShow() {
  46 +
  47 + },
  48 + // 点击减号
  49 + subtraction() {
  50 + let money = this.data.money * 1;
  51 + let num = this.data.num * 1;
  52 + let num1 = num - 1
  53 + if (num == '1') {
  54 + return false
  55 + }
  56 + this.setData({
  57 + num: num1,
  58 + totalize: (money * num1).toFixed(2)
  59 + })
  60 + },
  61 + // 点击加号
  62 + addition() {
  63 + let money = this.data.money * 1;
  64 + let num = this.data.num * 1;
  65 + let num1 = num + 1
  66 + this.setData({
  67 + num: num1,
  68 + totalize: (money * num1).toFixed(2)
  69 + })
  70 + },
  71 + // 提交订单
  72 + submitOrder() {
  73 + wx.navigateTo({
  74 + url: '/pack-activity/pack/confirmPayment',
  75 + })
  76 + },
  77 + /**
  78 + * 生命周期函数--监听页面隐藏
  79 + */
  80 + onHide() {
  81 +
  82 + },
  83 +
  84 + /**
  85 + * 生命周期函数--监听页面卸载
  86 + */
  87 + onUnload() {
  88 +
  89 + },
  90 +
  91 + /**
  92 + * 页面相关事件处理函数--监听用户下拉动作
  93 + */
  94 + onPullDownRefresh() {
  95 +
  96 + },
  97 +
  98 + /**
  99 + * 页面上拉触底事件的处理函数
  100 + */
  101 + onReachBottom() {
  102 +
  103 + },
  104 +
  105 + /**
  106 + * 用户点击右上角分享
  107 + */
  108 + onShareAppMessage() {
  109 +
  110 + }
  111 +})
  1 +// pack-cookbook/pages/index_new.js
  2 +var mta = require('mta-wechat-analysis')
  3 +import util from '../../utils/util';
  4 +import App from '../../utils/api';
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + type:'C',//样式A,B,C
  12 + scrollTop: 0,
  13 + isloading: true,
  14 + toView: "",
  15 + hasEnter: false,
  16 + totalWidth: getApp().system.windowWidth,
  17 + singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2),
  18 + totalHeight: getApp().system.windowHeight,
  19 + kindHeight: getApp().system.windowHeight - 68,
  20 + hasListModel: true,
  21 + cookbooklist: [{}, {}, {}, {}, {}, {}, {},],
  22 + showSkeleton: true,
  23 + order: {},
  24 + orderItemCount:0,
  25 + twoList:[
  26 + {
  27 + title:'烤鸽子',
  28 + info:'¥48/位 ',
  29 + vip:'会员 ¥38/位',
  30 + image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
  31 + quantum:0,
  32 + },
  33 + {
  34 + title:'烤鸽子',
  35 + info:'¥48/位 ',
  36 + vip:'会员 ¥38/位',
  37 + image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
  38 + quantum:0,
  39 + },
  40 + {
  41 + title:'烤鸽子',
  42 + info:'¥48/位 ',
  43 + vip:'会员 ¥38/位',
  44 + image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
  45 + quantum:0,
  46 + }
  47 + ],
  48 + dishList:[
  49 + {
  50 + image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
  51 + title:'默认菜品样式A',
  52 + info:'¥168/份 会员 ¥160/份',
  53 + normsInfo:'味型:咸鲜 烹调:熬煮',
  54 + dw:'1个 (如果没有会员价,则不显示会员价)',
  55 + zs:'有图大',
  56 + quantum:1,
  57 + js:'有(菜品录入了就有,没录入就没有)',
  58 + xz:'否,只显示加号',
  59 + ggInfo:'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
  60 + gg:'菜品名称(味型/烹调)和价格在顶部分开(默认),菜品味型/烹调 录入了才有,没录入没有。'
  61 + },
  62 + {
  63 + image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
  64 + title:'默认菜品样式A',
  65 + info:'¥168/份 会员 ¥160/份',
  66 + normsInfo:'味型:咸鲜 烹调:熬煮',
  67 + dw:'1个 (如果没有会员价,则不显示会员价)',
  68 + zs:'有图大',
  69 + quantum:0,
  70 + js:'有(菜品录入了就有,没录入就没有)',
  71 + xz:'否,只显示加号',
  72 + ggInfo:'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
  73 + gg:'菜品名称(味型/烹调)和价格在顶部分开(默认),菜品味型/烹调 录入了才有,没录入没有。'
  74 + },
  75 + ]
  76 + },
  77 +
  78 + /**
  79 + * 生命周期函数--监听页面加载
  80 + */
  81 + onLoad: function (options) {
  82 + this.setData({
  83 + options: options,
  84 + })
  85 + this.getCookList();
  86 + this.initOrder();
  87 + mta.Page.init({
  88 + "appID": "500667280",
  89 + "eventID": "500667287",
  90 + "statPullDownFresh": true,
  91 + "statShareApp": true,
  92 + "statReachBottom": true,
  93 + "lauchOpts": options, //渠道分析
  94 + });
  95 + },
  96 +
  97 + /**
  98 + * 生命周期函数--监听页面初次渲染完成
  99 + */
  100 + onReady() {
  101 +
  102 + },
  103 + // 点击加号
  104 + addition(e){
  105 + const item= e.currentTarget.dataset['item'];
  106 + const index= e.currentTarget.dataset['key'];
  107 + const type= e.currentTarget.dataset['type'];
  108 + let quantum = item.quantum * 1 + 1;
  109 + let obj;
  110 + if(type=='one') obj=`dishList[${index}].quantum`;
  111 + if(type=='two') obj=`twoList[${index}].quantum`;
  112 + this.setData({
  113 + [obj]:quantum
  114 + })
  115 + },
  116 + // 点击减号
  117 + subtraction(e){
  118 + const item= e.currentTarget.dataset['item'];
  119 + const index= e.currentTarget.dataset['key'];
  120 + const type= e.currentTarget.dataset['type'];
  121 + let quantum = item.quantum * 1 - 1;
  122 + let obj;
  123 + if(type=='one') obj=`dishList[${index}].quantum`;
  124 + if(type=='two') obj=`twoList[${index}].quantum`;
  125 + this.setData({
  126 + [obj]:quantum
  127 + })
  128 + },
  129 + initOrder() {
  130 + App.Advance.CreateOrder({
  131 + rid: this.data.options.rid,
  132 + identity: this.data.options.identity,
  133 + status: '0,1',
  134 + openid: getApp().openid,
  135 + }).then(res => {
  136 + let orderItemCount = 0;
  137 + res.data.cookbooklist.forEach(cb => {
  138 + if (this.data.options.identity == 1 && cb.status > 0) {
  139 + wx.redirectTo({
  140 + url: util.http_build_query({
  141 + rid: this.data.options.rid,
  142 + oid: res.data.id,
  143 + identity: 1
  144 + }, '/pack-cookbook/pages/success')
  145 + });
  146 + return false;
  147 + }
  148 + orderItemCount += parseInt(cb.num)
  149 + })
  150 + this.setData({
  151 + [`options.oid`]: res.data.id,
  152 + order: res.data,
  153 + orderItemCount: orderItemCount,
  154 + })
  155 + })
  156 + },
  157 + formatCookList(list){
  158 + //原栏目下显示
  159 + let hasShowClass = false;
  160 + //菜单中展示沽清的菜品
  161 + let hasClearCookbook = false;
  162 + //十道必选菜
  163 + let has10CaiOpen = false;
  164 + let flist = [];
  165 + if (list.length > 0) {
  166 + has10CaiOpen = list[0].status == 1;
  167 + list.forEach(function (cate, i) {
  168 + if (cate.status == 1 && cate.cookbooklist[0].length > 0) {
  169 + let cooks = [];
  170 + //let cooks_order=[];
  171 + cate.cookbooklist[0].forEach(function (cook, n) {
  172 + if (cook.status == 1) {
  173 + let flag = true;
  174 + if (has10CaiOpen) {
  175 + if (cate.class_type == 2 && !hasShowClass && flist.length > 0 && flist[0].class_type == 1) {
  176 + for (let fi = 0; fi < flist[0].cookbooklist[0].length; fi++) {
  177 + if (flist[0].cookbooklist[0][fi].id == cook.id) {
  178 + flag = false;
  179 + break;
  180 + }
  181 + }
  182 + }
  183 + }
  184 + cook.item_clear_num = cook.clear_num;
  185 + if (!hasClearCookbook) {//不显示卖光了
  186 + let item_clear_num = cook.clear_num;
  187 + if (cook.spec) {
  188 + let clear_num = null;
  189 + cook.spec.forEach(spec => {
  190 + if (spec.clear_num == 0) {
  191 + clear_num = 0;
  192 + } else {
  193 + clear_num = null;
  194 + }
  195 + })
  196 + if (clear_num == 0) {
  197 + item_clear_num = 0;
  198 + }
  199 + }
  200 + cook.item_clear_num = item_clear_num;
  201 + if (item_clear_num == 0) {
  202 + flag = false;
  203 + }
  204 + }
  205 +
  206 + if (flag) {
  207 + cooks.push(cook);
  208 + //cooks_order.push(cook.order_o);
  209 + }
  210 +
  211 + }
  212 + })
  213 + if (cooks.length > 0) {
  214 + //cooks 排序...
  215 +
  216 + cate.cookbooklist[0] = cooks;
  217 + flist.push(cate)
  218 + }
  219 + }
  220 + })
  221 + }
  222 + return flist;
  223 + },
  224 + getCookList: function (orderid) {
  225 + let param = {
  226 + sellerid: this.data.options.sid,
  227 + identity: this.data.options.identity,
  228 + orderid : this.data.options.oid,
  229 + status:'0,1',
  230 + };
  231 + App.Advance.GetCookbookByClass(param).then(json => {
  232 + //菜单分类添加修饰
  233 + let cookbooklist = this.formatCookList(json.data[0].list);
  234 + setTimeout(() => {
  235 + this.setData({
  236 + cookbooklist: cookbooklist,
  237 + countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0,
  238 + countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0,
  239 + isloading: false,
  240 + showSkeleton: false,
  241 + })
  242 + }, 0)
  243 +
  244 + }).catch(res => {
  245 + console.log('getCookList-catch', res);
  246 + this.selectComponent("#network").show('网络不给力,请检查网络后重试');
  247 + });
  248 + },
  249 + /**
  250 + * 生命周期函数--监听页面显示
  251 + */
  252 + onShow() {
  253 +
  254 + },
  255 +
  256 + /**
  257 + * 生命周期函数--监听页面隐藏
  258 + */
  259 + onHide() {
  260 +
  261 + },
  262 +
  263 + /**
  264 + * 生命周期函数--监听页面卸载
  265 + */
  266 + onUnload() {
  267 +
  268 + },
  269 +
  270 + /**
  271 + * 页面相关事件处理函数--监听用户下拉动作
  272 + */
  273 + onPullDownRefresh() {
  274 +
  275 + },
  276 +
  277 + /**
  278 + * 页面上拉触底事件的处理函数
  279 + */
  280 + onReachBottom() {
  281 +
  282 + },
  283 +
  284 + /**
  285 + * 用户点击右上角分享
  286 + */
  287 + onShareAppMessage() {
  288 +
  289 + }
  290 +})
  1 +{
  2 + "backgroundTextStyle": "light",
  3 + "navigationBarBackgroundColor": "#4d4e50",
  4 + "navigationBarTextStyle": "white",
  5 + "usingComponents": {
  6 + "foodCard": "../components/food-card/food-card",
  7 + "cookClass": "../components/cook-class/cook-class",
  8 + "nav":"/components/nav/nav",
  9 + "cart":"../components/cart/cart",
  10 + "formids":"/components/formids/formids",
  11 + "userinfo":"/components/userinfo/userinfo",
  12 + "network":"/components/network/network"
  13 + }
  14 + }
  1 +<!--pack-cookbook/pages/index_new.wxml-->
  2 +<nav backgroundColor="#4d4e50" color="#fff">{{options.seeAll||order.seller.sellername||'提前点菜'}}</nav>
  3 +<loading wx:if="{{isloading}}">数据加载中</loading>
  4 +<view class="wrapIine"></view>
  5 +<view wx:if="{{type=='A'}}" class="heand flex-vc flex-cc">
  6 + <view class="style_round flex-vc flex-cc">
  7 + <view class="round"></view>
  8 + <view class="line"></view>
  9 + </view>
  10 + <view class="title">10道必点菜</view>
  11 + <view class="style_round flex-vc flex-cc">
  12 + <view class="line"></view>
  13 + <view class="round"></view>
  14 + </view>
  15 +</view>
  16 +<view wx:if="{{type=='A'}}" class="wrapIine"></view>
  17 +<view class="dishWrap" wx:for="{{dishList}}" wx:key="index">
  18 + <block wx:if="{{type=='A'}}">
  19 + <view class="dishItem flex-lr">
  20 + <view class="dishLeft dishTexts">
  21 + {{item.title}}
  22 + </view>
  23 + <view class="dishTexts dishRight">
  24 + {{item.info}}
  25 + </view>
  26 + </view>
  27 + <view class="norms">
  28 + {{item.normsInfo}}
  29 + </view>
  30 + </block>
  31 + <block wx:if="{{type=='B'}}">
  32 + <view class="dishItem typeB">
  33 + <view class="dishLeft dishTexts">
  34 + {{item.title}}
  35 + </view>
  36 + <view class="dishTexts dishRight">
  37 + {{item.normsInfo}}
  38 + </view>
  39 + </view>
  40 + <view class="norms normsB">
  41 + {{item.info}}
  42 + </view>
  43 + </block>
  44 + <block wx:if="{{type=='C'}}">
  45 + <view class="dishItem">
  46 + <view class="dishLeft dishTexts">
  47 + {{item.title}}
  48 + </view>
  49 + <view class="dishTexts dishRight">
  50 + {{item.normsInfo}}
  51 + </view>
  52 + </view>
  53 + <view class="norms">
  54 + {{item.info}}
  55 + </view>
  56 + </block>
  57 + <image src="{{item.image}}" class="dishImg" mode="widthFix" />
  58 + <view class="greens">
  59 + <view class="news">
  60 + {{item.ggInfo}}
  61 + </view>
  62 + <view class="news">
  63 + <text class="Textcolor">样式说明:</text>{{item.gg}}
  64 + </view>
  65 + <view class="news">
  66 + <text class="Textcolor">售卖单位:</text>{{item.dw}}
  67 + </view>
  68 + <view class="news">
  69 + <text class="Textcolor">展示大小:</text>{{item.zs}}
  70 + </view>
  71 + <view class="news">
  72 + <text class="Textcolor">菜品介绍:</text>{{item.js}}
  73 + </view>
  74 + <view class="news">
  75 + <text class="Textcolor">是否选中:</text>{{item.xz}}
  76 + </view>
  77 + </view>
  78 + <view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr">
  79 + <image src="../add.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
  80 + </view>
  81 + <view wx:else class="algorithmImg flex-lr calculate">
  82 + <image src="../reduce.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="one" />
  83 + <view class="box flex-cc">
  84 + <view class="num flex-cc">
  85 + {{item.quantum}}<view>份</view>
  86 + </view>
  87 + <view class="practice">
  88 + 清蒸
  89 + </view>
  90 + </view>
  91 + <image src="../add.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
  92 + </view>
  93 + <view class="wrapIine"></view>
  94 +</view>
  95 +<view class="twoBox flex-rs">
  96 + <view class="twoItem" wx:for="{{twoList}}" wx:key="index">
  97 + <view class="twoTitle">
  98 + {{item.title}}
  99 + </view>
  100 + <view class="twoInfo">
  101 + {{item.info}}{{item.vip}}
  102 + </view>
  103 + {{item.quantum}}
  104 + <image src="{{item.image}}" mode="aspectFill" />
  105 + <view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr oneImg">
  106 + <image src="../add.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
  107 + </view>
  108 + <view wx:else class="algorithmImg flex-lr twoImgs">
  109 + <image src="../reduce.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="two" />
  110 + <view class="box flex-cc">
  111 + <view class="num flex-cc">
  112 + {{item.quantum}}
  113 + </view>
  114 + </view>
  115 + <image src="../add.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
  116 + </view>
  117 + </view>
  118 +</view>
  119 +<view class="fixedBox flex-lr">
  120 + <view class="left flex-cmc">
  121 + <image src="../img1.png" mode="" />
  122 + <view class="fixedName">
  123 + 菜品分类
  124 + </view>
  125 + </view>
  126 + <view class="right flex-cmc">
  127 + <image src="../img2.png" mode="" />
  128 + <view class="fixedName">
  129 + 已选菜品
  130 + </view>
  131 + </view>
  132 +</view>
  1 +/* pack-cookbook/pages/index_new.wxss */
  2 +page{
  3 + background-color: #4d4e50;
  4 +}
  5 +.wrapIine{
  6 + height: 4rpx;
  7 + width: 100%;
  8 + background-color: #dbdbdb;
  9 +}
  10 +.heand{
  11 + width: 100%;
  12 +}
  13 +.heand .style_round{
  14 + width: 160rpx;
  15 +}
  16 +.style_round .line{
  17 + width: 100rpx;
  18 + height: 2rpx;
  19 + background: #dbdbdb;
  20 +}
  21 +.style_round .round{
  22 + width: 8rpx;
  23 + height: 8rpx;
  24 + background: #dbdbdb;
  25 + border-radius: 50%;
  26 +}
  27 +.heand .title{
  28 + color: #fff;
  29 + padding: 10rpx 0;
  30 +}
  31 +.dishWrap{
  32 + color: #fff;
  33 + padding-top: 40rpx;
  34 +}
  35 +.dishTexts{
  36 + padding: 0 40rpx;
  37 + color: #dbdbdb;
  38 + font-family: PingFang SC;
  39 + font-weight: 500;
  40 + font-size: 40rpx;
  41 + -webkit-text-stroke: 1rpx black;
  42 +}
  43 +.dishRight{
  44 + font-family: PingFang SC;
  45 + font-weight: 500;
  46 + font-size: 28rpx;
  47 +}
  48 +.norms{
  49 + margin-top: 10rpx;
  50 + color: #dbdbdb;
  51 + font-family: PingFang SC;
  52 + font-size: 24rpx;
  53 + padding:0 40rpx 30rpx 40rpx;
  54 +}
  55 +.dishImg{
  56 + width: 100%;
  57 +}
  58 +.greens{
  59 + padding: 20rpx 32rpx 58rpx 32rpx;
  60 + color: #dbdbdb;
  61 + font-family: PingFang SC;
  62 + font-size: 24rpx;
  63 +}
  64 +.Textcolor{
  65 + color: #EBDD3C;
  66 +}
  67 +.algorithmImg{
  68 + height: 60rpx;
  69 + padding-bottom: 58rpx;
  70 +}
  71 +.algorithmImg .imgs{
  72 + width: 60rpx;
  73 + height: 100%;
  74 + margin-right: 80rpx;
  75 +}
  76 +.calculate{
  77 + padding: 0 80rpx 58rpx 80rpx;
  78 +}
  79 +.calculate .imgs{
  80 + width: 60rpx;
  81 + height: 60rpx;
  82 + margin: 0;
  83 +}
  84 +
  85 +.box .num{
  86 + color: #e34d59;
  87 + font-family: PingFang SC;
  88 + font-weight: 500;
  89 + font-size: 80rpx;
  90 +}
  91 +.num view{
  92 + color: #dbdbdb;
  93 + font-family: PingFang SC;
  94 + font-weight: 500;
  95 + font-size: 32rpx;
  96 + margin:0 20rpx;
  97 +}
  98 +.twoItem{
  99 + width: 50%;
  100 + box-sizing: border-box;
  101 + border-bottom: 4rpx solid #dbdbdb;
  102 +}
  103 +.twoItem:nth-of-type(odd){
  104 + border-right: 4rpx solid #dbdbdb;
  105 +}
  106 +.twoTitle{
  107 + padding: 30rpx 0 10rpx 20rpx;
  108 + color: #dbdbdb;
  109 + font-family: PingFang SC;
  110 + font-weight: 500;
  111 + font-size: 40rpx;
  112 +}
  113 +.twoInfo{
  114 + color: #dbdbdb;
  115 + font-family: PingFang SC;
  116 + font-weight: 500;
  117 + font-size: 24rpx;
  118 + padding: 0 0 30rpx 20rpx;
  119 +}
  120 +.twoItem image{
  121 + height: 247rpx;
  122 +}
  123 +.oneImg{
  124 + margin: 38rpx 40rpx 0 0;
  125 +}
  126 +.twoImgs{
  127 + margin: 38rpx 40rpx 0 40rpx;
  128 +}
  129 +.twoBox .imgs{
  130 + margin-right: 0;
  131 +}
  132 +.reduceImg{
  133 + width: 90rpx;
  134 + height: 8rpx !important;
  135 +}
  136 +.fixedBox{
  137 + position: fixed;
  138 + bottom: 0;
  139 + left: 0;
  140 + width: 100%;
  141 + padding: 18rpx 80rpx 18rpx 80rpx;
  142 + box-sizing: border-box;
  143 + background-color: #4D4E50;
  144 +}
  145 +.fixedBox .left image{
  146 + width: 44rpx;
  147 + height: 36rpx;
  148 +}
  149 +.fixedBox .right image{
  150 + width: 41rpx;
  151 + height: 36rpx;
  152 +}
  153 +.fixedName{
  154 + color: #dbdbdb;
  155 + font-family: PingFang SC;
  156 + font-weight: 500;
  157 + font-size: 24rpx;
  158 + margin-top: 10rpx;
  159 +}
  160 +.typeB{
  161 + display: flex;
  162 + align-items: flex-end;
  163 + flex-direction: column;
  164 +}
  165 +.normsB{
  166 + text-align: right;
  167 +}
  168 +
  169 +
  170 +
  171 +
  172 +
  173 +
  174 +
  175 +
  176 +
  177 +
  178 +
  179 +
  180 +
  181 +
@@ -16,7 +16,6 @@ Page({ @@ -16,7 +16,6 @@ Page({
16 detail:{}, 16 detail:{},
17 staffinfo:{}, 17 staffinfo:{},
18 between: false, 18 between: false,
19 - is_display:true,  
20 id: null, 19 id: null,
21 msgTpl: '', 20 msgTpl: '',
22 chef: {}, 21 chef: {},
@@ -25,7 +24,10 @@ Page({ @@ -25,7 +24,10 @@ Page({
25 reserve: {}, 24 reserve: {},
26 signboard: {}, 25 signboard: {},
27 store: {}, 26 store: {},
  27 + recharge_data:{},
  28 + coupon_data:{},
28 homeColor: '', 29 homeColor: '',
  30 + use:'',
29 current: 0, 31 current: 0,
30 theme: 'blackGold', //blue green blackGold 32 theme: 'blackGold', //blue green blackGold
31 seller: { 33 seller: {
@@ -36,6 +38,7 @@ Page({ @@ -36,6 +38,7 @@ Page({
36 }, 38 },
37 priceInfo:'', 39 priceInfo:'',
38 scoreInfo:'', 40 scoreInfo:'',
  41 + discount:'',
39 }, 42 },
40 /** 43 /**
41 * 生命周期函数--监听页面加载 44 * 生命周期函数--监听页面加载
@@ -162,11 +165,6 @@ Page({ @@ -162,11 +165,6 @@ Page({
162 long:reserev.seller.long, 165 long:reserev.seller.long,
163 } 166 }
164 }) 167 })
165 - if(this.data.seller.sid=="677" || this.data.seller.sid=="26" || this.data.seller.sid=="8" || this.data.seller.sid=="4352"){  
166 - this.setData({  
167 - is_display : false  
168 - })  
169 - }  
170 console.log('reserevreserevreserevreserevreserev',reserev); 168 console.log('reserevreserevreserevreserevreserev',reserev);
171 console.log('sellersellersellerseller',this.data.seller); 169 console.log('sellersellersellerseller',this.data.seller);
172 console.log('detaildetaildetaildetail',this.data.detail); 170 console.log('detaildetaildetaildetail',this.data.detail);
@@ -207,6 +205,7 @@ Page({ @@ -207,6 +205,7 @@ Page({
207 if (res.ret != 200) { 205 if (res.ret != 200) {
208 return util.toast(res.msg, 'none') 206 return util.toast(res.msg, 'none')
209 } 207 }
  208 + console.log(this.id,res.data.id,res.data.sellerid);
210 wx.navigateTo({ 209 wx.navigateTo({
211 url: util.http_build_query({ 210 url: util.http_build_query({
212 rid: this.id, 211 rid: this.id,
@@ -262,21 +261,46 @@ Page({ @@ -262,21 +261,46 @@ Page({
262 App.Seller.GetSellerTemplateConf({ 261 App.Seller.GetSellerTemplateConf({
263 sid 262 sid
264 }).then(res => { 263 }).then(res => {
265 - let home,chef,marketing,reserve,signboard,store,homeColor,priceInfo,scoreInfo,recharge_data,recharge_list;  
266 - chef = util.parseDataValue(res.data.chef)  
267 - reserve = util.parseDataValue(res.data.reserve)  
268 - marketing = util.parseDataValue(res.data.marketing)  
269 - signboard = util.parseDataValue(res.data.signboard)  
270 - store = util.parseDataValue(res.data.store)  
271 - home = util.parseDataValue(res.data.home)  
272 - if(marketing.is_recharge=='1'){  
273 - recharge_data=marketing.recharge_data 264 + let data=res.data
  265 + let home,chef,marketing,reserve,signboard,store,homeColor,coupon_data,priceInfo,scoreInfo,recharge_list;
  266 + chef = data.chef ? JSON.parse(data.chef) : '';
  267 + reserve = data.reserve ? JSON.parse(data.reserve) : '';
  268 + marketing = data.marketing ? JSON.parse(data.marketing) : '';
  269 + signboard = data.signboard ? JSON.parse(data.signboard) : '';
  270 + store = data.store ? JSON.parse(data.store) : '';
  271 + home = data.home ? JSON.parse(data.home) : '';
  272 + coupon_data=marketing.coupon_data;
  273 + let use=JSON.stringify(marketing.coupon_data.use)
  274 + if(marketing.is_recharge=='1' && marketing.recharge_data){
  275 + let recharge_data=marketing.recharge_data
274 recharge_list=marketing.recharge_data.recharge_list 276 recharge_list=marketing.recharge_data.recharge_list
275 if(recharge_list.is_price=='1') priceInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.price+'元余额'; 277 if(recharge_list.is_price=='1') priceInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.price+'元余额';
276 if(recharge_list.is_score=='1') scoreInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.score+'积分'; 278 if(recharge_list.is_score=='1') scoreInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.score+'积分';
  279 + console.log('scoreInfo',scoreInfo);
  280 + this.setData({
  281 + recharge_data:marketing.recharge_data
  282 + })
  283 + console.log('recharge_data',recharge_data);
  284 + }
  285 + this.setData({
  286 + coupon_data,
  287 + use
  288 + })
  289 + // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
  290 + if(marketing.is_coupon=='1' && coupon_data && (!coupon_data.use.is_cash || coupon_data.use.is_cash=='1')){
  291 + let cash=coupon_data.use.cash;
  292 + let price=coupon_data.price*1;
  293 + let discount=((price/cash)*10).toFixed(2);
  294 + console.log('cash',cash);
  295 + console.log('price',price);
  296 + console.log('discount',discount);
  297 + this.setData({
  298 + discount,
  299 + coupon_data
  300 + })
277 } 301 }
278 - if(store && store.images.length>0) store.images =util.parseDataValue(store.images)  
279 - if(signboard && signboard.images) signboard.images = util.parseDataValue(signboard.images) 302 + if(store && store.images.length>0) store.images =store.images?JSON.parse(store.images):'';
  303 + if(signboard && signboard.images) signboard.images = signboard.images?JSON.parse(signboard.images):'';
280 if (marketing && marketing.is_online_book=='1' && marketing.is_transpond =='1') { 304 if (marketing && marketing.is_online_book=='1' && marketing.is_transpond =='1') {
281 this.setData({ 305 this.setData({
282 between: true 306 between: true
@@ -188,46 +188,50 @@ @@ -188,46 +188,50 @@
188 </view> 188 </view>
189 </view> 189 </view>
190 </view> 190 </view>
191 - <!-- <view class="preferential" wx:if="{{marketing && (marketing.is_coupon=='1' || marketing.is_recharge=='1')}}"> -->  
192 - <view class="preferential"> 191 + <view class="preferential" wx:if="{{marketing && (marketing.is_coupon=='1' || marketing.is_recharge=='1')}}">
193 <view class="rubric rubric1"> 192 <view class="rubric rubric1">
194 特别优惠 193 特别优惠
195 </view> 194 </view>
196 - <!-- <view class="preferentialItems" wx:if="{{marketing && marketing.is_coupon=='1'}}"> -->  
197 - <view class="preferentialItems" wx:if="{{marketing.is_coupon=='1'}}"> 195 + <view class="preferentialItems" wx:if="{{marketing && marketing.is_coupon=='1'}}">
198 <view class="left"> 196 <view class="left">
199 <view class="top"> 197 <view class="top">
200 - <text>{{marketing.coupon_data.aname}}代金券</text>  
201 - <!-- <text class="price">¥{{ticketList.ticket.price1}}</text>  
202 - <text class="discount">{{ticketList.ticket.rebate}}折</text> --> 198 + <text>{{coupon_data.aname}}</text>
  199 + <text class="price" wx:if="{{coupon_data.price}}">¥{{coupon_data.price}}</text>
  200 + <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
  201 + <text wx:if="{{coupon_data.use.is_cash=='1' || coupon_data.use.is_cash}}" class="discount">{{discount}}折</text>
  202 + </view>
  203 + <view wx:if="{{coupon_data.exp_date.is_week=='1' || coupon_data.exp_date.is_week}}" class="bottom" >
  204 + {{coupon_data.exp_date.week_show?coupon_data.exp_date.week_show+'可用':''}}{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
  205 + </view>
  206 + <view wx:if="{{coupon_data.exp_date.is_none=='1' || coupon_data.exp_date.is_none}}" class="bottom" >
  207 + 无限制{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
  208 + </view>
  209 + <view wx:if="{{coupon_data.exp_date.is_birthday=='1' || coupon_data.exp_date.is_birthday}}" class="bottom" >
  210 + 生日当天可用{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
203 </view> 211 </view>
204 - <!-- <view class="bottom">  
205 - {{ticketList.ticket.info}}  
206 - </view> -->  
207 </view> 212 </view>
208 - <navigator url="/pack-activity/pack/buyCoupon?id={{marketing.coupon_data.id}}&name={{seller.name}}" hover-class="navigator-hover"> 213 + <navigator url="/pack-activity/pack/buyCoupon?id={{coupon_data.id}}&name={{seller.name}}&use={{use}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
209 <view class="font24r orderingFood"> 214 <view class="font24r orderingFood">
210 去抢购 215 去抢购
211 </view> 216 </view>
212 </navigator> 217 </navigator>
213 </view> 218 </view>
214 - <!-- <view class="preferentialItems" wx:if="{{marketing && marketing.is_recharge=='1'}}"> -->  
215 - <view class="preferentialItems" wx:if="{{marketing.is_recharge=='1'}}"> 219 + <view class="preferentialItems" wx:if="{{marketing && marketing.is_recharge=='1' && recharge_data}}">
216 <view class="left"> 220 <view class="left">
217 <view class="top"> 221 <view class="top">
218 - <text>{{marketing.recharge_data.rname}}</text> 222 + <text>{{recharge_data.rname}}</text>
219 </view> 223 </view>
220 - <view class="bottom">  
221 - {{priceInfo}}{{(marketing.recharge_data.recharge_list.is_coupons=='0' && marketing.recharge_data.recharge_list.is_score=='0')?'。':';'}} 224 + <view class="bottom" wx:if="{{priceInfo}}">
  225 + {{priceInfo}}{{(recharge_data.recharge_list.is_coupons=='0' && recharge_data.recharge_list.is_score=='0')?'。':';'}}
222 </view> 226 </view>
223 - <view class="bottom">  
224 - {{scoreInfo}}{{marketing.recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 227 + <view class="bottom" wx:if="{{scoreInfo}}">
  228 + {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
225 </view> 229 </view>
226 - <view class="bottom">  
227 - {{marketing.recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送优惠券':''}}。 230 + <view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
  231 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送优惠券':''}}。
228 </view> 232 </view>
229 </view> 233 </view>
230 - <navigator url="/pack-activity/pack/vipRecharge?id={{marketing.recharge_data.id}}&name={{seller.name}}" hover-class="navigator-hover"> 234 + <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
231 <view class="font24r orderingFood"> 235 <view class="font24r orderingFood">
232 去充值 236 去充值
233 </view> 237 </view>
@@ -503,6 +503,8 @@ @@ -503,6 +503,8 @@
503 margin: 0 10rpx 0 20rpx; 503 margin: 0 10rpx 0 20rpx;
504 font-family: PingFang SC; 504 font-family: PingFang SC;
505 font-size: 14rpx; 505 font-size: 14rpx;
  506 + height: 30rpx;
  507 + line-height: 30rpx;
506 } 508 }
507 509
508 .top .price { 510 .top .price {
@@ -634,5 +634,15 @@ export default { @@ -634,5 +634,15 @@ export default {
634 //客户经理优惠券信息 634 //客户经理优惠券信息
635 'App.Activity.GetActivityById':{ 635 'App.Activity.GetActivityById':{
636 openid:'openid' 636 openid:'openid'
  637 + },
  638 +
  639 + //创建购买优惠活动订单
  640 + 'App.Activity.CreateNewRechargeOrder':{
  641 + openid:'openid'
  642 + },
  643 +
  644 + //合单支付
  645 + 'App.PayOnline.CombineTransactionsByRecharge':{
  646 + openid:'openid'
637 } 647 }
638 } 648 }