From 67682de4c7abae641498ca4e361cc73885c1f1a8 Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Tue, 14 Jan 2020 15:25:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/orderconfirm/input/input.js | 8 +- components/orderconfirm/input/input.wxml | 2 +- components/orderconfirm/time/time.js | 1 + components/particulars/content/index.js | 3 +- components/particulars/content/index.wxml | 2 +- pages/orderconfirm/orderconfirm.js | 161 +++++++++++++++++----- pages/orderconfirm/orderconfirm.wxml | 6 +- pages/particulars/particulars.json | 1 + pages/particulars/particulars.wxml | 2 +- pages/receiving/receiving.json | 1 + pages/receiving/receiving.wxml | 2 +- pages/undetermined/undetermined.json | 1 + pages/undetermined/undetermined.wxml | 2 +- 13 files changed, 143 insertions(+), 49 deletions(-) diff --git a/components/orderconfirm/input/input.js b/components/orderconfirm/input/input.js index 2e1273e..77dcf48 100644 --- a/components/orderconfirm/input/input.js +++ b/components/orderconfirm/input/input.js @@ -4,8 +4,8 @@ Component({ * 组件的属性列表 */ properties: { - title:String, - placeholder:String + title: String, + placeholder: String }, /** @@ -19,6 +19,8 @@ Component({ * 组件的方法列表 */ methods: { - + input(a) { + this.triggerEvent("input",{value:a.detail.value}) + } } }) diff --git a/components/orderconfirm/input/input.wxml b/components/orderconfirm/input/input.wxml index b5c6b94..1f972d3 100644 --- a/components/orderconfirm/input/input.wxml +++ b/components/orderconfirm/input/input.wxml @@ -1,4 +1,4 @@ {{title}} - + \ No newline at end of file diff --git a/components/orderconfirm/time/time.js b/components/orderconfirm/time/time.js index 54d629c..05b2c73 100644 --- a/components/orderconfirm/time/time.js +++ b/components/orderconfirm/time/time.js @@ -29,6 +29,7 @@ Component({ this.setData({ date: e.detail.value }) + this.triggerEvent("input",{date:e.detail.value}) }, getCurTime() { var date = new Date(); diff --git a/components/particulars/content/index.js b/components/particulars/content/index.js index 9218396..ac22a47 100644 --- a/components/particulars/content/index.js +++ b/components/particulars/content/index.js @@ -6,7 +6,8 @@ Component({ number:String, time:String, text:String, - goods:Array + goods:Array, + ziti:String }, data: { }, diff --git a/components/particulars/content/index.wxml b/components/particulars/content/index.wxml index 5bdcc1e..b2e5a82 100644 --- a/components/particulars/content/index.wxml +++ b/components/particulars/content/index.wxml @@ -15,7 +15,7 @@ 配送方式 - 快递 + {{ziti == 1?"自提":"快递"}} 备注: diff --git a/pages/orderconfirm/orderconfirm.js b/pages/orderconfirm/orderconfirm.js index d54354c..3e8b0b4 100644 --- a/pages/orderconfirm/orderconfirm.js +++ b/pages/orderconfirm/orderconfirm.js @@ -7,7 +7,10 @@ Page({ */ data: { list: {}, - fs:0 + fs:0, + date:"", + phone:"", + name:"" }, /** @@ -78,56 +81,140 @@ Page({ }, sub() { - if (this.data.list.addressList == null) { + if (this.data.list.addressList == null && this.data.fs == 0) { wx.showToast({ title: "请先添加地址", icon: "none" }) + } + if ((!this.data.name || !this.data.phone || !this.data.date) && this.data.fs == 1) { + wx.showToast({ + title: "请完善提货信息", + icon: "none" + }) console.log(123) return; } - bin.getuserid().then((res) => { - bin.request({ - url: "Cart/cart3", - urldata: { - act: "", - submit_order: "", - user_id: res, - address_id: this.data.list.addressList.address_id, - user_money: 0, - pay_points: 0, - couponTypeSelect: 1, - coupon_id: 0, - pay_code: "weixin", - couponCode: "" - } - }).then((r) => { - console.log(r) - let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata - // timeStamp = timeStamp - timeStamp = timeStamp.toString() - console.log(timeStamp) - wx.requestPayment({ - timeStamp, nonceStr, package: r.data.data.wdata.package, signType, paySign: sign, - success(res) { - console.log("成功") - wx.redirectTo({ - url: "/pages/order/order?index=1" - }) - }, - fail(res) { console.log(res) - wx.redirectTo({ - url: "/pages/order/order?index=0" - })} + if(this.data.fs == 0){ + bin.getuserid().then((res) => { + bin.request({ + url: "Cart/cart3", + urldata: { + act: "", + submit_order: "", + user_id: res, + address_id: this.data.list.addressList.address_id, + user_money: 0, + pay_points: 0, + couponTypeSelect: 1, + coupon_id: 0, + pay_code: "weixin", + couponCode: "" + } + }).then((r) => { + console.log(r) + let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata + // timeStamp = timeStamp + timeStamp = timeStamp.toString() + console.log(timeStamp) + wx.requestPayment({ + timeStamp, nonceStr, package: r.data.data.wdata.package, signType, paySign: sign, + success(res) { + console.log("成功") + wx.redirectTo({ + url: "/pages/order/order?index=1" + }) + }, + fail(res) { console.log(res) + wx.redirectTo({ + url: "/pages/order/order?index=0" + })} + }) }) }) - }) + }else{ + bin.getuserid().then((res) => { + bin.request({ + url: "Cart/cart3", + urldata: { + act: "", + submit_order: "", + user_id: res, + user_money: 0, + pay_points: 0, + couponTypeSelect: 1, + coupon_id: 0, + pay_code: "weixin", + couponCode: "", + + }, + data:{ + ziti_name:this.data.name, + ziti_phone:this.data.phone, + ziti_date:this.data.date, + delivery:"ziti" + } + }).then((r) => { + console.log(r) + let { timeStamp, nonceStr, signType, sign } = r.data.data.wdata + // timeStamp = timeStamp + timeStamp = timeStamp.toString() + console.log(timeStamp) + wx.requestPayment({ + timeStamp, nonceStr, package: r.data.data.wdata.package, signType, paySign: sign, + success(res) { + console.log("成功") + wx.redirectTo({ + url: "/pages/order/order?index=1" + }) + }, + fail(res) { console.log(res) + wx.redirectTo({ + url: "/pages/order/order?index=0" + })} + }) + }) + }) + } + }, tab(a){ console.log(a.detail.id) + bin.getuserid().then((res) => { + bin.request({ + url: "Cart/cart2", + urldata: { + user_id: res + }, + data:{ + delivery:a.detail.id == 1 ? "ziti" : "express" + } + }).then((res) => { + console.log(res) + this.setData({ + list: res.data.result + }) + this.setData({ + fs:a.detail.id + }) + }) + }) + + }, + date(a){ this.setData({ - fs:a.detail.id + date:a.detail.date + }) + }, + name(a){ + this.setData({ + name:a.detail.value + }) + }, + phone(a){ + this.setData({ + phone:a.detail.value }) } }) \ No newline at end of file diff --git a/pages/orderconfirm/orderconfirm.wxml b/pages/orderconfirm/orderconfirm.wxml index c6a9109..12c91dd 100644 --- a/pages/orderconfirm/orderconfirm.wxml +++ b/pages/orderconfirm/orderconfirm.wxml @@ -4,9 +4,9 @@ - - - + + + diff --git a/pages/particulars/particulars.json b/pages/particulars/particulars.json index 130cb91..9199745 100644 --- a/pages/particulars/particulars.json +++ b/pages/particulars/particulars.json @@ -1,4 +1,5 @@ { + "navigationBarTitleText": "订单详情", "usingComponents": { "content":"../components/particulars/content/index", "orderchooseaddr":"../components/particulars/orderchooseaddr/index", diff --git a/pages/particulars/particulars.wxml b/pages/particulars/particulars.wxml index bb788fb..2f53e63 100644 --- a/pages/particulars/particulars.wxml +++ b/pages/particulars/particulars.wxml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/pages/receiving/receiving.json b/pages/receiving/receiving.json index c285b38..3d54d73 100644 --- a/pages/receiving/receiving.json +++ b/pages/receiving/receiving.json @@ -1,4 +1,5 @@ { + "navigationBarTitleText": "订单详情", "usingComponents": { "content":"../components/particulars/content/index", "orderchooseaddr":"../components/particulars/orderchooseaddr/index" diff --git a/pages/receiving/receiving.wxml b/pages/receiving/receiving.wxml index 0421bac..741d8d5 100644 --- a/pages/receiving/receiving.wxml +++ b/pages/receiving/receiving.wxml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/pages/undetermined/undetermined.json b/pages/undetermined/undetermined.json index c285b38..3d54d73 100644 --- a/pages/undetermined/undetermined.json +++ b/pages/undetermined/undetermined.json @@ -1,4 +1,5 @@ { + "navigationBarTitleText": "订单详情", "usingComponents": { "content":"../components/particulars/content/index", "orderchooseaddr":"../components/particulars/orderchooseaddr/index" diff --git a/pages/undetermined/undetermined.wxml b/pages/undetermined/undetermined.wxml index 8510b42..7c4c65e 100644 --- a/pages/undetermined/undetermined.wxml +++ b/pages/undetermined/undetermined.wxml @@ -1,4 +1,4 @@ - + \ No newline at end of file