From 4f099c68bd8bc140476be1664a85bdf7c0ad787d Mon Sep 17 00:00:00 2001 From: shaojing <2901156235@qq.com> Date: Fri, 20 Oct 2023 15:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=88=E5=88=A4=E6=96=AD=E5=87=BA=E8=A1=8C?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/orderList/index.js | 3 +- pages/order/orderList/index.wxml | 3 +- pages/order/scene/index.js | 173 ++++++++++++++++++++++++------- pages/order/scene/index.wxml | 2 +- 4 files changed, 142 insertions(+), 39 deletions(-) diff --git a/pages/order/orderList/index.js b/pages/order/orderList/index.js index 12bc3c1..ac9592b 100644 --- a/pages/order/orderList/index.js +++ b/pages/order/orderList/index.js @@ -37,6 +37,7 @@ Page({ flag:options.flag, // linkmanList: app.globalData.linkmanList }) + console.log('-------------',app.globalData.list); let price = 0, sku_id = [] ,postFee= 0; app.globalData.postProduct.map(item => { if (!app.globalData.kjId && !this.data.gp_id) { @@ -49,7 +50,7 @@ Page({ sku_id.push(item.sku.id) }) app.globalData.list.map(item => { - price = price + item.sku.price * item.num; + price = price + item.sku.price * item.linkmanList.length; sku_id.push(item.sku.id) }) this.setData({ diff --git a/pages/order/orderList/index.wxml b/pages/order/orderList/index.wxml index 56db585..9514af6 100644 --- a/pages/order/orderList/index.wxml +++ b/pages/order/orderList/index.wxml @@ -42,7 +42,8 @@ {{item.sku.sku_name}} - X{{item.num}} + + X{{item.linkmanList.length}} 出行人信息 diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 7546be7..f75b2eb 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -72,11 +72,11 @@ Page({ this.couponCom = this.selectAllComponents("#coupon")[0]; } }, - next: function () { - this.setData({ - showMask:true - }) - }, + // next: function () { + // this.setData({ + // showMask:true + // }) + // }, cancel: function () { this.setData({ showMask:false @@ -209,42 +209,12 @@ Page({ }) }, - order: function () { - console.log(this.data) + order:function() { let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; let linkmanIds = []; - // if (linkmanList.length < productNum && app.globalData.product.isGroup != 1) { - // wx.showToast({ - // title: '请选择' + productNum + "个出行人", - // icon: "none" - // }) - // return; - // } - if (!date && this.data.ticket_type == 1) { - wx.showToast({ - title: '请选择使用日期', - icon: 'none' - }) - return - } - if (!time && date && date.is_time_stock == true) { - wx.showToast({ - title: '请选择使用时间', - icon: 'none' - }) - return - } - if (app.globalData.product.isGroup == 1 && !this.data.groupName) { - wx.showToast({ - title: '请输入团队主体名称', - icon: 'none' - }) - return; - } linkmanList.map(item => { linkmanIds.push(item.id) }) - console.log(date) let data = { coupon_id: this.data.coupon ? this.data.coupon.id : null, source: "WECHATXCX", @@ -337,6 +307,137 @@ Page({ } } }, + next: function () { + console.log(this.data) + let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; + let linkmanIds = []; + if (linkmanList.length < productNum && app.globalData.product.isGroup != 1) { + wx.showToast({ + title: '请添加出行人', + icon: "none" + }) + return; + } + if (!date && this.data.ticket_type == 1) { + wx.showToast({ + title: '请选择使用日期', + icon: 'none' + }) + return + } + if (!time && date && date.is_time_stock == true) { + wx.showToast({ + title: '请选择使用时间', + icon: 'none' + }) + return + } + if (app.globalData.product.isGroup == 1 && !this.data.groupName) { + wx.showToast({ + title: '请输入团队主体名称', + icon: 'none' + }) + return; + } + this.setData({ + showMask:true + }) + // linkmanList.map(item => { + // linkmanIds.push(item.id) + // }) + // console.log(date) + // let data = { + // coupon_id: this.data.coupon ? this.data.coupon.id : null, + // source: "WECHATXCX", + // product_list: [{ + // type: product.product.type, + // product_id: product.product.id, + // sku_id: (date && date.sku_id) ? date.sku_id : product.sku.id, + // start_time: time.start_time, + // end_time: time.end_time, + // use_date: date ? date.date : '', + // visitors: linkmanIds.join(","), + // remark: remark, + // product_num: app.globalData.product.isGroup == 1 ? 1 : productNum + // }], + // originate_order_id: this.data.kjId, + // gp_id: app.globalData.gp_id, + // team_id: app.globalData.team_id, + // linkmanList:this.data.linkmanList + // } + // if (app.globalData.from) { + // data.system_name = app.globalData.from; + // } + // if (app.globalData.retailId) { + // data.commission_code = app.globalData.retailId; + // app.globalData.retailId = null; + // } + // if (app.globalData.category_id) { + // data.category_id = app.globalData.category_id; + // } + // if (this.data.prizeId) { + // data.lottery_id = this.data.prizeId + // } + // let service = 'order/create', postData = { + // data: JSON.stringify(data) + // } + // if (app.globalData.product.isGroup == 1) { + // service = "team_order/appoint" + // postData.member_num = this.data.productNum + // postData.team_name = this.data.groupName + // postData.type = 1; + // } + // if(app.globalData.list){ + // app.globalData.list[app.globalData.index] = this.data.product + // app.globalData.list[app.globalData.index].linkmanList = this.data.linkmanList + // } + // // app.globalData.linkmanList = this.data.linkmanList + // app.globalData.ticketPrice += (this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0))/100; + // console.log(app.globalData); + // if(app.globalData.list && app.globalData.list.length > app.globalData.index + 1 &&this.data.type!='museum'){ + // if(app.globalData.createDate){ + // app.globalData.createDate.product_list.push(data.product_list[0]) + // }else{ + // app.globalData.createDate = data + // } + // app.globalData.index = app.globalData.index + 1 + // app.globalData.product = app.globalData.list[app.globalData.index] + // wx.redirectTo({ + // url: '/pages/order/scene/index?flag='+ this.data.flag+'&isCar='+this.data.isCar, + // }) + // return + // }else{ + // if(app.globalData.list && app.globalData.list.length > 1 || app.globalData.postProduct.length>0){ + // if(app.globalData.createDate){ + // app.globalData.createDate.product_list.push(data.product_list[0]) + // } + // wx.redirectTo({ + // url: '/pages/order/orderList/index?flag='+ this.data.flag + // }) + // }else{ + // commonApi.user_post(service, postData).then(res => { + // if (app.globalData.kjId) { + // this.setData({ + // kjId: null + // }); + // app.globalData.kjId = null; + // } + // if (app.globalData.gp_id) { + // this.setData({ + // gp_id: null + // }); + // app.globalData.gp_id = null; + // } + // if (res.code == 1 && app.globalData.product.isGroup == 1) { + // // 团购跳转到团购详情 + // wx.navigateTo({ + // url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order' + // }) + // } + // }) + // } + // } + }, // 活动预约 activityOrder: function () { if (this.data.linkmanList && this.data.linkmanList.length > 0) { diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml index d1e0bbc..7266012 100644 --- a/pages/order/scene/index.wxml +++ b/pages/order/scene/index.wxml @@ -83,7 +83,7 @@ 取消 - 无问题,去支付 + 无问题,下一步