From e2fca5b688d186b34dc451d274d966f6b4c7043f Mon Sep 17 00:00:00 2001 From: chenshengle <954534408@qq.com> Date: Thu, 25 Aug 2022 14:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 5 +- app.json | 3 +- assets/images/explain.gif | Bin 0 -> 2169 bytes assets/images/goOder.png | Bin 0 -> 1441 bytes assets/images/password.png | Bin 0 -> 5583 bytes config/config.js | 11 +- ext.json | 45 +- index/index.js | 4 +- index/index.ttml | 3 +- index/user.ttss | 2 +- pages/coupon/confirmation/confirmation.js | 859 +++++++------ pages/coupon/confirmation/confirmation.ttml | 12 +- pages/coupon/confirmation/confirmation.ttss | 55 +- pages/coupon/detail/index.js | 507 +------- pages/coupon/detail/index.ttml | 14 +- pages/coupon/instructions/instructions.js | 197 +++ pages/coupon/instructions/instructions.json | 12 + pages/coupon/instructions/instructions.ttml | 39 + pages/coupon/instructions/instructions.ttss | 1209 +++++++++++++++++++ pages/couponorder/detail/index.js | 32 + pages/couponorder/detail/index.ttml | 5 +- pages/couponorder/detail/index.ttss | 15 +- pages/getuserinfo/getuserinfo.js | 502 ++++---- pages/liveLsit/liveLsit.js | 11 + pages/liveLsit/liveLsit.ttml | 10 + pages/liveLsit/liveLsit.ttss | 45 +- pages/order/detail/index.js | 345 +++++- pages/order/detail/index.ttml | 55 +- pages/order/detail/index.ttss | 6 + pages/order/index/index.ttml | 4 +- pages/paySnapshoot/paySnapshoot.js | 73 +- pages/paySnapshoot/paySnapshoot.ttml | 37 +- project.config.json | 13 +- 33 files changed, 2924 insertions(+), 1206 deletions(-) create mode 100644 assets/images/explain.gif create mode 100644 assets/images/goOder.png create mode 100644 assets/images/password.png create mode 100644 pages/coupon/instructions/instructions.js create mode 100644 pages/coupon/instructions/instructions.json create mode 100644 pages/coupon/instructions/instructions.ttml create mode 100644 pages/coupon/instructions/instructions.ttss diff --git a/app.js b/app.js index 536309e..dd97840 100644 --- a/app.js +++ b/app.js @@ -33,10 +33,12 @@ App({ } catch (error) { console.log(`获取系统信息失败`); } + that.logn(); tt.getSystemInfo({ success(res) { + console.log(res,"**"); that.globalData.systemInfo = res - that.logn(); + }, fail(res) { console.log(`getSystemInfo 调用失败`); @@ -75,6 +77,7 @@ App({ tt.login({ success:(res=>{ let {code} = res + console.log(code,"code"); Http.post({ url:config.api.login, data:{ diff --git a/app.json b/app.json index aa6ada9..010bb38 100644 --- a/app.json +++ b/app.json @@ -36,7 +36,8 @@ "pages/refund/refund", "pages/serviceWebView/serviceWebView", "pages/liveLsit/liveLsit", - "pages/coupon/confirmation/confirmation" + "pages/coupon/confirmation/confirmation", + "pages/coupon/instructions/instructions" ], "window": { "backgroundTextStyle": "light", diff --git a/assets/images/explain.gif b/assets/images/explain.gif new file mode 100644 index 0000000000000000000000000000000000000000..d84d0b969a20ca80b6df7669e1d9db641990bd49 GIT binary patch literal 2169 zcmZ?wbhEHbOkqf2XkcXc4+e_=x&2&2f}I@$T#fV$m>C%u7=S_%z5xm@i6x0Z+Qz=3 zATc>RwL~E)H9a%WR_Xoj{Yna%DYi=CroINg16w1-Ypui3%0DIeEoa6}C!=DfvmMRzNmLSYJs2tfVB{R>=`0p#ZYeIlm}X!Bo#! zH`&0@P{GVh&(Orw%*;?n!N|bSNZ$a6%ybP+tW3?UjLa3FKnZADQA(Oskc%7CE+EfV zDWjyMz)D}gyu4hm+*mKaC|%#s($W%ShLMpjP=#)BWnM{Qg>GK4GRy>*)Z*l#%z~24 z{5%DaiHS-1r6smXK$k+ikXzvE3pY5gSP$$Wz2y8{{ffi_eM3D1{oGuTzrd=COM+4n z&cLd=IHa;5RX-@TIKQ+gITff}8KxN+cK9s0NRfu)h5lbMl=o3nwDD@?CvUU5lcUUDkT-b|pq5WPljc=cL27o{eau$h8JcxGNoetEGbD0(2ibxAGC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_ zrqQzi-y`J=_%5O-Z!USf`{2Y3FkWQF2a@)#uxKQ5|Kj#t-(D3UW5fXL1w%;jGTs)N zxz!8nSpft4H?%2{$oIvD1dKS$Z_!wEx9HgQn@j*dr1efBGXAdwmKsbTM2P8Y25lE= z_fZ)?wzY8?L0QYdtCR4IVWF9e{0opaG=@WxqRx|k`?hl1(x;}2N%M7qBBmdlfeT|YYxKWt&7A@J+5bFRtlQ=N-MMVw7cwMOG zwuTU(@YX0o$HBO<28n}+PVPN(>x!gbCC&X^QG4W)4(96K4Kn@Gs+sAA8iIv?03~-6 z;ELV^OV0+zexaF9y5Z|G1MH0PF&NKCClCaX`4yq1-fxI?fNdF{0dRdn6GX0V97MD^ z7Eiv{5CROQH!gBW`2xU#Y9&00m+-lWn~yY13*-YCKJwBHSFT*q9fzyB5>!AJg=Xg8 z0J|P_nE^Gq>XJ@E0m6k)ofblp6?M&Sy1(5$; zVjkOMUlyvlv+9$q0tZ>k=x5-eVv1;#Z&|!L^{4BS+RImd(*qdx)bj-1#6-tL+{{)G zXW*vi4m>}1%!#fi(4_kV0xrc=^L8(Xo-Ocm|GGJ&f6w`e!S2Qcn;3rto=KU63@igM z&&B*Jp_(gv3y?Q(`%f)1zPgzaVQnmK?kP)vyiwLlT=1-dx}_!On20`&#gk7@hc5ZS z#Eh*3<_@8y_LY)KN`O2`;ma@1br5K=11urH*H>Vr0tw*!5Hk-cgmX=fvvc8^-d|-n vr3H{7n~9iEfSGvJf{Zz=fFRYJiCq5yf;w4l?~$VF00000NkvXXu0mjfE0LQZ literal 0 HcmV?d00001 diff --git a/assets/images/password.png b/assets/images/password.png new file mode 100644 index 0000000000000000000000000000000000000000..44170512db2369d890de66002c0c4d7820afb6df GIT binary patch literal 5583 zcmeI0`9Dw!V77RO`AH zjeuzmL-GvSKOEn6d}*k9|4FG~9A0Ie&!F@|UQ$5P#a5Nz%tMO!N0U>xZk~1qKN*0m zh1cTZemBVd<(7}^dAwWiP5qg+d(C}qF%cg0d_Zw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jsN~J1` z_etBJ`IL?+oSPiLvr=bs%$6{5d%x04X?0|EdqmoPLT1w}*lwbDd3%IpQTwj3FR&SQaJ#QV-YY1o3| z(aZZqRQZHtZhUvR>yC$(7iosAM?B3L$89|73k+e6>+sz zW*$=9L)n{-!^$J^*MTpF!rS`cqu%ChU?&MuJ^V=76cb?1`O50gOHqL~P2-iWzjGhj`?`|6sqnU9c9+&riqtD_ky5kNI~ceFF-SIgYO>E5dV@c={mqGo9O&iX z@E<|-l8;}d+J7ySO8rGicY#;XQ<85fA# z@us^(%|DSUUiG2t*LsX|^(PgkACV&aI9vRuH!f3Sm_du&isQ1F^Vs|P|GiL=L=h79 zw8AXfJN|cCf>ZB~Xrzvy5bQ;00RH9LB~D>^6eR6*mehhiaQod|lAa7N*|j!W;6NSkS(NF96=cjqr$|hq-GO8my;Vf#(C-V~ zn&Og{&Clznsv&K$q+iWZh^uAqXn&PM)@W kx-7%LLH;i}X*yv@ZRNXRQNq4N7is}5HC+tpj`fTG0bw6-jsO4v literal 0 HcmV?d00001 diff --git a/config/config.js b/config/config.js index be5aa71..f56403e 100644 --- a/config/config.js +++ b/config/config.js @@ -137,6 +137,11 @@ var config = { * 支付订单 */ payOrderCreate: "/pay/create", + /** + * 2.0订单支付 + */ + payOrderCreate_2: "/pay/ttcreatev2", + /** * 订单状态更新 */ @@ -456,7 +461,11 @@ var config = { /** * 取消订单 */ - orderCancel:"/order/cancel" + orderCancel:"/order/cancel", + /** + * 判断是否支付 + */ + continueToPay:"/order/continueToPay", }, weapp: { AppId: weappId diff --git a/ext.json b/ext.json index 3c445fc..38a9f64 100644 --- a/ext.json +++ b/ext.json @@ -1,21 +1,30 @@ { - "extEnable": true, - "extAppid": "ttef6599d8705b49b101", - "window": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#fff", - "navigationBarTextStyle": "black" - }, - "ext": { - "weappId": "ttef6599d8705b49b101", - "name": "富茂券模板", - "attr": { - "configUrl": "https://ctest.malls.iformall.com/C/api" - } - }, - "directCommit": false, - "networkTimeout": { - "request": 30000, - "downloadFile": 10000 + "extEnable": true, + "extAppid": "ttef6599d8705b49b101", + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTextStyle": "black" + }, + "ttPlugins": { + "dependencies": { + "microapp-trade-plugin": { + "version": "1.1.2", + "isDynamic": true + } } + }, + "ext": { + "weappId": "ttef6599d8705b49b101", + "name": "富茂券模板", + "attr": { + "configUrl": "https://ctest.malls.iformall.com/C/api" + } + }, + "directCommit": false, + "networkTimeout": { + "request": 30000, + "downloadFile": 10000 + } + } \ No newline at end of file diff --git a/index/index.js b/index/index.js index 6e43139..b14f135 100644 --- a/index/index.js +++ b/index/index.js @@ -518,9 +518,7 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onLoad: function (options) { - console.log(123); - - + let that = this; let optionss; diff --git a/index/index.ttml b/index/index.ttml index 4ad720c..eed13d3 100644 --- a/index/index.ttml +++ b/index/index.ttml @@ -213,4 +213,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/index/user.ttss b/index/user.ttss index f329b5f..df80720 100644 --- a/index/user.ttss +++ b/index/user.ttss @@ -7,7 +7,7 @@ /* background: #F1F6F7 */ position: relative; background-color: #e6e6e6; - + overflow: hidden; } .bgImgTop{ width: 100%; diff --git a/pages/coupon/confirmation/confirmation.js b/pages/coupon/confirmation/confirmation.js index fd7ff04..7778598 100644 --- a/pages/coupon/confirmation/confirmation.js +++ b/pages/coupon/confirmation/confirmation.js @@ -6,12 +6,12 @@ const util = require("../../../utils/util"); const imgurl = require("../../../utils/imgurl"); Page({ data: { - couponIds:"", - couponChannelId:"", - showPage:false, - data:{}, - spuIdObj:{}, - priceAndStockObj:{} + couponIds: "", + couponChannelId: "", + showPage: false, + data: {}, + spuIdObj: {}, + priceAndStockObj: {} }, onLoad: function (options) { console.log(options); @@ -19,27 +19,37 @@ Page({ title: "加载中..." }); let that = this - if (app.globalData.token){ - if (options && options.couponChannelId ) { - that.setData({ - couponChannelId:options.couponChannelId - }) - that.getDetail(options.couponChannelId, 'notendclock'); + if (app.globalData.token) { + if (options && options.couponChannelId) { + that.setData({ + couponChannelId: options.couponChannelId + }) + that.getDetail(options.couponChannelId, 'notendclock'); } - }else{ + } else { app.tokenCallback = token => { that.setData({ - couponChannelId:options.couponChannelId + couponChannelId: options.couponChannelId }) - if (options && options.couponChannelId ) { - that.getDetail(options.couponChannelId, 'notendclock'); - + if (options && options.couponChannelId) { + that.getDetail(options.couponChannelId, 'notendclock'); + } } } - + }, + goInstructions() { + tt.navigateTo({ + url: '/pages/coupon/instructions/instructions?couponChannelId=' + this.data.couponChannelId, + success: (res) => { + + }, + fail: (res) => { + }, + }); + }, getSupId(id) { Http.get({ url: config.api.getSpuid, @@ -90,191 +100,259 @@ Page({ }; Http.get(parmer).then(res => { + that.setData({ + couponId: res.data.couponId + }) + /** + * activityStatus==0 活动未开始 + * activityStatus==1 活动已开始 + * flag == endclock 说明倒计时已经结束 + */ + if (res.data.endTime && res.data.beginTime) { that.setData({ - couponId: res.data.couponId + begin_time: res.data.beginTime, + end_time: res.data.endTime, + activityStatus: res.data.actStatus ? res.data.actStatus : '' }) - /** - * activityStatus==0 活动未开始 - * activityStatus==1 活动已开始 - * flag == endclock 说明倒计时已经结束 - */ - if (res.data.endTime && res.data.beginTime) { - that.setData({ - begin_time: res.data.beginTime, - end_time: res.data.endTime, - activityStatus: res.data.actStatus ? res.data.actStatus : '' - }) - if (res.data.actStatus == 0 && flag != 'endclock') { - that.countdown(res.data.beginTime); - } else if (res.data.actStatus != 0 && flag != 'endclock') { - that.countdown(res.data.endTime); + if (res.data.actStatus == 0 && flag != 'endclock') { + that.countdown(res.data.beginTime); + } else if (res.data.actStatus != 0 && flag != 'endclock') { + that.countdown(res.data.endTime); + } else { + clearInterval(that.data.setInterval) + } + if (res.data.actStatus == 0) { + var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(beginTime).indexOf('-') == 0) { + that.setData({ + beginTime: "活动已结束", + }); } else { - clearInterval(that.data.setInterval) + that.setData({ + beginTime: util.timechuo(beginTime) + }); } - if (res.data.actStatus == 0) { - var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss"); - if (util.timechuo(beginTime).indexOf('-') == 0) { - that.setData({ - beginTime: "活动已结束", - }); - } else { - that.setData({ - beginTime: util.timechuo(beginTime) - }); - } + } else { + var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(endTime).indexOf('-') == 0) { + that.setData({ + endtime: "活动已结束", + }); } else { - var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); - if (util.timechuo(endTime).indexOf('-') == 0) { - that.setData({ - endtime: "活动已结束", - }); - } else { - that.setData({ - endtime: util.timechuo(endTime) - }); - } + that.setData({ + endtime: util.timechuo(endTime) + }); } } - tt.hideLoading(); + } + tt.hideLoading(); + that.setData({ + data: res.data, + }); + if (res.data.type == 10) { that.setData({ - data: res.data, + salePriceStr: res.data.salePriceStr, + pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), + pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), + priceStr: res.data.priceStr, + tailPriceStr: res.data.tailPriceStr, + origPriceStr: res.data.origPriceStr + }) + } + if (res.data.validType == 1) { + that.setData({ + validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), + validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"), + pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), + pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), }); - if (res.data.type == 10) { - that.setData({ - salePriceStr: res.data.salePriceStr, - pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), - pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), - priceStr: res.data.priceStr, - tailPriceStr: res.data.tailPriceStr, - origPriceStr: res.data.origPriceStr - }) - } - if (res.data.validType == 1) { + } else { + if (res.data.validDays) { that.setData({ - validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), - validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"), - pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), - pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), + validDays: res.data.validDays }); - } else { - if (res.data.validDays) { - that.setData({ - validDays: res.data.validDays - }); - } } + } - if (res.data.itemGroup) { - let tempObj = this.data.data - tempObj.itemGroup = JSON.parse(tempObj.itemGroup) - this.setData({ - data: tempObj - }) - console.log(this.data.data, "data"); - } + if (res.data.itemGroup) { + let tempObj = this.data.data + tempObj.itemGroup = JSON.parse(tempObj.itemGroup) + this.setData({ + data: tempObj + }) + console.log(this.data.data, "data"); + } - if (res.data.productAttrs && res.data.skuAttrs) { - let tempObj = this.data.data - tempObj.productAttrs = JSON.parse(tempObj.productAttrs) - tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs) - tempObj.productAttrs.map(item => { - if (item.key == "Notification") { - if (item.data != '') { - tempObj.curLsit = JSON.parse(item.data) - } - } - if (item.key == "bring_out_meal") { - tempObj.besides = item.data - } - if (item.key == "free_pack") { - tempObj.pack = item.data + if (res.data.productAttrs && res.data.skuAttrs) { + let tempObj = this.data.data + tempObj.productAttrs = JSON.parse(tempObj.productAttrs) + tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs) + tempObj.productAttrs.map(item => { + if (item.key == "Notification") { + if (item.data != '') { + tempObj.curLsit = JSON.parse(item.data) } + } + if (item.key == "bring_out_meal") { + tempObj.besides = item.data + } + if (item.key == "free_pack") { + tempObj.pack = item.data + } - if (item.key == "superimposed_discounts") { - tempObj.superimposed_discounts = item.data - } - if (item.key == "private_room") { - tempObj.private_room = item.data - } - if (item.key == "rec_person_num_max") { - tempObj.rec_person_num_max = item.data - } + if (item.key == "superimposed_discounts") { + tempObj.superimposed_discounts = item.data + } + if (item.key == "private_room") { + tempObj.private_room = item.data + } + if (item.key == "rec_person_num_max") { + tempObj.rec_person_num_max = item.data + } - if (item.key == 'Description') { - tempObj.Description = JSON.parse(item.data) - } - if (item.key == "can_no_use_date") { - tempObj.can_no_use_date = JSON.parse(item.data) - } - }) + if (item.key == 'Description') { + tempObj.Description = JSON.parse(item.data) + } + if (item.key == "can_no_use_date") { + tempObj.can_no_use_date = JSON.parse(item.data) + } + }) - tempObj.skuAttrs.map(item => { - if (item.key == "commodity") { - if (item.data != '') { - tempObj.itemGroup = JSON.parse(item.data) - } + tempObj.skuAttrs.map(item => { + if (item.key == "commodity") { + if (item.data != '') { + tempObj.itemGroup = JSON.parse(item.data) } - }) - this.setData({ - data: tempObj - }) - console.log(this.data.data, "data"); - } - }).catch(err => { - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }) + } + }) + this.setData({ + data: tempObj + }) + console.log(this.data.data, "data"); + } + }).catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) }, - /** - * 支付订单更新 - */ + /** + * 支付订单更新 + */ payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => { - let that = this; - // 支付成功 - Http.post({ - url: config.api.payOrderUpdate, - data: { - payOrderId: payOrderId, - composeOrderId: orderId, - status: status, - reason: reason + let that = this; + // 支付成功 + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }) + .then(res => { + tt.hideLoading() + // 有价券 + if (!type && type != 'free') { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${orderId + }` + }); + } else if (type == 'free') { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${orderId + }` + }); } }) - .then(res => { - tt.hideLoading() - // 有价券 - if (!type && type != 'free') { - tt.navigateTo({ - url: `/pages/order/detail/index?orderId=${orderId - }` - }); - } else if (type == 'free') { - tt.navigateTo({ - url: `/pages/order/detail/index?orderId=${orderId - }` - }); + .catch(err => { + console.log(err); + if (!type) { + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType); + }, 2000) + } + }) + }, + + // 获得未支付的订单 + getUnPaidOrder(couponId) { + let that = this; + Http.get({ + url: config.api.getUnPaidOrder, + data: { + couponId: couponId + } + }).then(res => { + that.setData({ + disOrderNumber: res.data.orderNumber, + composeOrderType: res.data.composeOrderType + }) + + if (res.data && res.data.pressEndDate) { + that.setData({ + dispressEndDate: true + }) + } else { + that.setData({ + dispressEndDate: false + }) + } + if (that.data.dispressEndDate) { + tt.showModal({ + title: '提示', + content: "您有未支付订单,请到“我的-我的砍价”进行支付", + confirmText: "我的砍价", + success: function (res) { + if (res.confirm) { + tt.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}&composeOrderType=${that.data.composeOrderType}`, + }) + } } }) - .catch(err => { - console.log(err); - if (!type) { - setTimeout(function () { - _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType); - }, 2000) + } else { + tt.showModal({ + title: '提示', + content: '您有未支付订单,请先进行支付', + confirmText: "去支付", + success: function (res1) { + if (res1.confirm) { + + if (that.data.composeOrderType > 0) {//券包 + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, + }) + } else { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, + }) + } + + } } }) + } + }).catch(error => { + tt.showToast({ + title: error.message, + icon: "none", + duration: 3000 + }) + }) }, + /** * 发起支付 */ - orderFunc(discount) { - if(this.data.showbutton)return; + orderFunc(discount) { + if (this.data.showbutton) return; let that = this; tt.showLoading({ @@ -293,8 +371,8 @@ Page({ url: config.api.checkPhoneStatus, data: {} }).then(res => { - - if ((!tt.canIUse('createOrder')) || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) { + // + // if (!tt.canIUse('createOrder') || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) { //积分券和免费券 // 发起砍价 if (discount == 'discount') { @@ -357,120 +435,191 @@ Page({ }); if (res.data.payment > 0) { // 支付金额不为0 - /** + if (tt.canIUse('createOrder')) { + Http.post({ + url: config.api.payOrderCreate_2, + data: { + orderId: orderId, + composeOrderType: res.data.composeOrderType + } + }).then(res => { + console.log(res,"789789"); + let tempCallbackData = { + composeOrderId:res.data.outOrderNo + } + // tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id + let options = { + callbackData: tempCallbackData, + goodsList: res.data.goodsList, + payment: res.data.payment, + success: res => { + tt.hideLoading(); + that.setData({ + showbutton: false, + }) + const { orderId, outOrderNo } = res; + that.setData({ orderId, outOrderNo }); + that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); + }, + fail: res => { + const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; + if (errLogId) { + tt.hideLoading(); + that.setData({ + showbutton: false, + }) + console.log('预下单失败', errNo, errMsg, errLogId); + let tempErrmsg = errMsg.split('开发者拒绝交易:'); + tt.showToast({ + title: tempErrmsg[tempErrmsg.length - 1], + icon: 'none', + duration: 2000, + mask: false + }); + } + if (orderId || outOrderNo) { + tt.hideLoading(); + that.setData({ + showbutton: false, + }) + console.log('支付失败', errNo, errMsg, orderId, outOrderNo); + console.log(that.payOrderUpdate, "payOrderUpdate"); + tt.showToast({ + title: "取消支付", + icon: 'none', + duration: 2000, + mask: false + }); + that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail') + } + }, + } + console.log(options, "options"); + tt.createOrder(options) + }) + + } else {//不支持2.0支付 + /** * 支付订单创建 */ - Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: orderId, - composeOrderType: res.data.composeOrderType - } - }).then(res => { - var payOrderId = "" + res.data.outOrderNo; - tt.hideLoading(); - tt.pay({ - service: 5, - orderInfo: { - order_id: res.data.orderId, - order_token: res.data.token, - }, - success: res => { - tt.showLoading({ - title: '订单正在处理中...', - }) - if (res.code === 0) { - that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that, that.data.composeOrderType); - if (res.errMsg == "requestPayment:ok") { - /** - * 用户支付成功以后跳转到券包列表 - */ - if (that.data.cardType == 100) { - tt.setStorage({ - key: 'couponNum2', - data: "couponNum2" - }) - } else if (that.data.data.type != 5 && that.data.cardType != 100) { - tt.setStorage({ - key: 'couponNum', - data: "couponNum" - }) + tt.showToast({ + title: '请升级抖音', // 内容 + icon: "none" + }); + return + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: orderId, + composeOrderType: res.data.composeOrderType + } + }).then(res => { + var payOrderId = "" + res.data.outOrderNo; + tt.hideLoading(); + tt.pay({ + service: 5, + orderInfo: { + order_id: res.data.payOrderId, + order_token: res.data.payOrderToken, + }, + success: res => { + tt.showLoading({ + title: '订单正在处理中...', + }) + if (res.code === 0) { + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that, that.data.composeOrderType); + if (res.errMsg == "requestPayment:ok") { + /** + * 用户支付成功以后跳转到券包列表 + */ + if (that.data.cardType == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.data.type != 5 && that.data.cardType != 100) { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } } } - } - else if (res.code === 1) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付超时', // 内容 - icon: "none" - }); + else if (res.code === 1) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付超时', // 内容 + icon: "none" + }); - } else if (res.code === 2) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付失败', // 内容 - icon: "none" - }); - } else if (res.code === 3) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付关闭', // 内容 - icon: "none" - }); - } else if (res.code === 4) { - that.setData({ - showbutton: false - }) + } else if (res.code === 2) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付失败', // 内容 + icon: "none" + }); + } else if (res.code === 3) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付关闭', // 内容 + icon: "none" + }); + } else if (res.code === 4) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付取消', // 内容 + icon: "none" + }); + } else if (res.code === 9) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '订单状态开发者自行获取', // 内容 + icon: "none" + }); + } + + }, + fail: res => { tt.hideLoading(); - tt.showToast({ - title: '支付取消', // 内容 - icon: "none" - }); - } else if (res.code === 9) { + /** + * 支付失败,需要更新订单的状态 + */ + that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that, that.data.composeOrderType); that.setData({ showbutton: false }) - tt.hideLoading(); - tt.showToast({ - title: '订单状态开发者自行获取', // 内容 - icon: "none" - }); - } - - }, - fail: res => { - tt.hideLoading(); - /** - * 支付失败,需要更新订单的状态 - */ - that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that, that.data.composeOrderType); - that.setData({ - showbutton: false - }) - return; - }, - complete: res => { } - }); - /// End payment -------- - }) - .catch(err => { - tt.hideLoading(); - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false + return; + }, + complete: res => { } }); + /// End payment -------- }) + .catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + } else { // 免费券 that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); @@ -494,71 +643,105 @@ Page({ }) } } - }) - } else { - //有价券 - console.log(tt.canIUse('createOrder'), "是否支持2.0js-api"); - if (tt.canIUse('createOrder')) { - //支持 支付2.0 js-api - let tempCallbackData = {} - tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id - let options = { - callbackData: tempCallbackData, - goodsList: [ - { - quantity: 1, // 购买数量 必填 - price: that.data.priceAndStockObj.salePrice, // 商品价格 必填 - - goodsName: that.data.data.title, // 商品名称 必填 - goodsPhoto: that.data.data.coverImg, // 商品图片链接 必填 - goodsId: that.data.data.couponChannel.ttSpuId, // 商品ID 必填 - goodsType: 1, // 商品类型 必填 - - goodsLabels: ['过期退', '随时退', '免预约'], // 商品标签 非必填 - dateRule: '', // 使用规则 非必填 + }).catch(err => { + tt.hideLoading(); + that.setData({ + showbutton: false, + }) + if (err.code == 3012) { + that.getUnPaidOrder(that.data.couponId); + } else { + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + success(res) { + console.log(res); }, - ], - payment: { - totalAmount: that.data.priceAndStockObj.salePrice, // 订单总价 必填 - }, - success: res => { - tt.hideLoading(); - that.setData({ - showbutton: false, - }) - const { orderId, outOrderNo } = res; - that.setData({ orderId, outOrderNo }); - that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); - }, - fail: res => { - const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; - if (errLogId) { - tt.hideLoading(); - that.setData({ - showbutton: false, - }) - console.log('预下单失败', errNo, errMsg, errLogId); - } - if (orderId || outOrderNo) { - tt.hideLoading(); - that.setData({ - showbutton: false, - }) - console.log('支付失败', errNo, errMsg, orderId, outOrderNo); - console.log(that.payOrderUpdate, "payOrderUpdate"); - that.payOrderUpdate(outOrderNo,outOrderNo,2,'','fail') - } - }, + fail(res) { + console.log("showToast 调用失败", res); + }, + }); } - console.log(options, "options"); - tt.createOrder(options) - } else { - //不支持 支付2.0 js -api - } - } + + }) + // } else { + // //有价券 + // console.log(tt.canIUse('createOrder'), "是否支持2.0js-api"); + // if (tt.canIUse('createOrder')) { + // //支持 支付2.0 js-api + // let tempCallbackData = {} + // tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id + // let options = { + // callbackData: tempCallbackData, + // goodsList: [ + // { + // quantity: 1, // 购买数量 必填 + // price: that.data.priceAndStockObj.salePrice, // 商品价格 必填 + + // goodsName: that.data.data.title, // 商品名称 必填 + // goodsPhoto: that.data.data.coverImg, // 商品图片链接 必填 + // goodsId: that.data.data.couponChannel.ttSpuId, // 商品ID 必填 + // goodsType: 1, // 商品类型 必填 + + // goodsLabels: ['过期退', '随时退', '免预约'], // 商品标签 非必填 + // dateRule: '', // 使用规则 非必填 + // }, + // ], + // payment: { + // totalAmount: that.data.priceAndStockObj.salePrice, // 订单总价 必填 + // }, + // success: res => { + // tt.hideLoading(); + // that.setData({ + // showbutton: false, + // }) + // const { orderId, outOrderNo } = res; + // that.setData({ orderId, outOrderNo }); + // that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); + // }, + // fail: res => { + // const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; + // if (errLogId) { + // tt.hideLoading(); + // that.setData({ + // showbutton: false, + // }) + // console.log('预下单失败', errNo, errMsg, errLogId); + // let tempErrmsg = errMsg.split('开发者拒绝交易:'); + // tt.showToast({ + // title: tempErrmsg[tempErrmsg.length - 1], + // icon: 'none', + // duration: 2000, + // mask: false + // }); + // } + // if (orderId || outOrderNo) { + // tt.hideLoading(); + // that.setData({ + // showbutton: false, + // }) + // console.log('支付失败', errNo, errMsg, orderId, outOrderNo); + // console.log(that.payOrderUpdate, "payOrderUpdate"); + // tt.showToast({ + // title: "取消支付", + // icon: 'none', + // duration: 2000, + // mask: false + // }); + // that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail') + // } + // }, + // } + // console.log(options, "options"); + // tt.createOrder(options) + // } else { + // //不支持 支付2.0 js -api + // } + // } }).catch(err => { - + tt.hideLoading() that.setData({ showbutton: false, @@ -625,7 +808,7 @@ Page({ /** * 将值传到用户手机号授权的页面 * - */ + */ tt.navigateTo({ url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` }); @@ -648,7 +831,7 @@ Page({ that.setData({ showbutton: false, }) - console.log(err) + console.log(err) if (err.code == 11004) { tt.navigateTo({ url: `/pages/getuserinfo/getuserinfo?fromflag=confirmation&confirmationFlag=${that.data.couponChannelId}`, diff --git a/pages/coupon/confirmation/confirmation.ttml b/pages/coupon/confirmation/confirmation.ttml index 839c5e4..f655611 100644 --- a/pages/coupon/confirmation/confirmation.ttml +++ b/pages/coupon/confirmation/confirmation.ttml @@ -5,15 +5,19 @@ {{data.title}} - ¥{{data.salePriceStr}} + {{data.type==50?priceAndStockObj.creditPrice+'积分':'¥'+priceAndStockObj.salePrice/100}} {{data.subTitle}} 实付 - ¥ - {{data.salePriceStr}} - 提交订单 + {{data.type!=50?'¥':''}} + {{data.type==50?priceAndStockObj.creditPrice+'积分':priceAndStockObj.salePrice/100}} + {{data.type==50?'立即换购':'提交订单'}} + + + 使用须知 + \ No newline at end of file diff --git a/pages/coupon/confirmation/confirmation.ttss b/pages/coupon/confirmation/confirmation.ttss index a3b0efb..eb8f34b 100644 --- a/pages/coupon/confirmation/confirmation.ttss +++ b/pages/coupon/confirmation/confirmation.ttss @@ -6,8 +6,8 @@ margin: 10rpx auto; } .commodityImgBox{ - width: 100rpx; - height: 100rpx; + width: 160rpx; + height: 160rpx; overflow: hidden; float: left; margin: 20rpx; @@ -19,7 +19,7 @@ } .contentBox{ - width: 560rpx; + width: 500rpx; float: left; height: 100rpx; @@ -30,9 +30,9 @@ } .title{ - height: 60rpx; - font-size: 26rpx; - width: 490rpx; + height: 90rpx; + font-size: 32rpx; + width: 400rpx; float: left; text-overflow: ellipsis; display: -webkit-box; @@ -42,16 +42,16 @@ } .unit{ float: right; - font-size: 24rpx; + font-size: 30rpx; } .subhead{ margin-top: 4rpx; color: #a6a6a6; - font-size: 20rpx; + font-size: 24rpx; } .app-border-topX{ width: 100%; - height: 120rpx; + height: 140rpx; background-color: #fff; overflow: hidden; position: fixed; @@ -60,22 +60,22 @@ } .actually{ margin-left: 10%; - font-size: 24rpx; + font-size: 28rpx; color: #a6a6a6; - line-height: 120rpx; + line-height: 140rpx; float: left; } .payZ{ margin-left: 6rpx; - font-size: 20rpx; + font-size: 24rpx; color: #d5af67; - line-height: 126rpx; + line-height: 144rpx; float: left; } .price{ - font-size: 26rpx; + font-size: 30rpx; color: #d5af67; - line-height: 120rpx; + line-height: 140rpx; float: left; } .buyX{ @@ -84,9 +84,30 @@ /* width: 80rpx; */ color: #fff; - font-size: 28rpx; + font-size: 30rpx; border-radius: 60rpx; margin: 30rpx 40rpx; - padding: 10rpx 20rpx; + padding: 20rpx 40rpx; +} +.go{ + height: 120rpx; + width: 96%; + border-radius: 6px; + overflow: hidden; + margin: 5px auto; + background-color: #fff; +} +.goTitle{ + float: left; + line-height: 120rpx; + font-size: 30rpx; + /* color: #a6a6a6; */ + margin-left: 20rpx; +} +.goImg{ + float: right; + width: 20rpx; + height: 40rpx; + margin: 40rpx 20rpx; } \ No newline at end of file diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 3d8b5ad..469717c 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -420,97 +420,8 @@ Page({ url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, }) return - let that = this; - app.globalData.previewFlag = true - /* 判断是否授权*/ - Http.get({ - url: config.api.checkUserStatus, - data: { - token: app.globalData.token - } - }).then(res => { - Http.get({ - url: config.api.checkPhoneStatus, - }).then(res => { - tt.showLoading(); - if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50) { - tt.navigateTo({ - url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId, - }) - } else { - let formId = e.detail.formId ? e.detail.formId : ""; - var discount = e.currentTarget.dataset.discount; - that.setData({ - queueData: null, - showbutton: true, - formId: formId - }) - Http.get({ - url: config.api.getQuestion, - data: { - couponType: JSON.stringify(that.data.data.type) - } - }).then(res => { - tt.hideLoading(); - if (res.data == undefined) { - // 立即购买 - that.orderFunc(discount); - that.setData({ - flag: false - }) - } else if (res.data) { - var animation = tt.createAnimation({}); - animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({ - duration: 500 - }) - that.setData({ - queueData: animation.export(), - zIndex: 9, - opacity: 1, - display: "block", - questionnaire: JSON.parse(res.data.content), - questionId: res.data.id - }); - } - }).catch(err => { - tt.hideLoading(); - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }) - } - }).catch(err => { - app.globalData.type = '' - app.globalData.skipUrl = "" - app.globalData.skip = 'navigateBack' - if (app.globalData.ifCongPh == 1) { - tt.navigateTo({ - url: '/pages/getPhone/getPhone?skipUrl=1', - }); - } else { - this.setData({ - showBox: true - }) - } - - }) - }).catch(err => { - app.globalData.type = '' - if (err.code == 11004) {//未授权抖音 - tt.navigateTo({ - url: `/pages/getuserinfo/getuserinfo?fromflag=coupondetail&couponChannelIdflag=${this.data.couponChannelId}`, - - }); - } - }) - - - - }, + setIntervalTime(end_time) { let that = this; var EndTime = end_time; @@ -588,6 +499,7 @@ Page({ onshow: false }) if (options && (options.couponChannelId || options.couponIds)) { + if (options.couponIds) { this.setData({ couponIds: options.couponIds @@ -674,7 +586,7 @@ Page({ getCouponMerchant(couponChannelId) {//获取适用门店 Http.get({ url: config.api.couponMerchant, - data: { + data: { couponChannelId: couponChannelId } }).then(res => { @@ -700,6 +612,7 @@ Page({ let data = {}; that.getCouponMerchant(couponChannelId);//获取适用门店 that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 + if (that.data.couponIds) { data.couponId = couponChannelId } else { @@ -771,7 +684,7 @@ Page({ }); var EndTime = res.data.validStartDate; var NowTime = new Date().getTime(); - + /** * activityStatus==0 活动未开始 * activityStatus==1 活动已开始 @@ -843,6 +756,8 @@ Page({ } } + + if (res.data.itemGroup) { let tempObj = this.data.data tempObj.itemGroup = JSON.parse(tempObj.itemGroup) @@ -857,6 +772,21 @@ Page({ tempObj.productAttrs = JSON.parse(tempObj.productAttrs) tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs) tempObj.productAttrs.map(item => { + if (item.key == "appointment") { + let tempAppoinObj = JSON.parse(item.data) + if (tempAppoinObj.need_appointment) { + let subscribeSing = ""; + if (tempAppoinObj.ahead_time_type == 1) { + subscribeSing = `需提前${tempAppoinObj.ahead_day_num}天致电商家预约` + } else if (tempAppoinObj.ahead_time_type == 2) { + subscribeSing = `需提前${tempAppoinObj.ahead_hour_num}小时致电商家预约` + } else if (tempAppoinObj.ahead_time_type == 3) { + subscribeSing = `需提前${tempAppoinObj.ahead_minute_num}分钟致电商家预约` + } + tempObj.subscribeSing = subscribeSing + } + + } if (item.key == "Notification") { if (item.data != '') { tempObj.curLsit = JSON.parse(item.data) @@ -887,12 +817,9 @@ Page({ tempObj.can_no_use_date = JSON.parse(item.data) } }) - tempObj.skuAttrs.map(item => { - if (item.key == "commodity") { - if (item.data != '') { + if (item.key == "commodity"&&item.data) { tempObj.itemGroup = JSON.parse(item.data) - } } }) this.setData({ @@ -1003,395 +930,9 @@ Page({ tt.navigateTo({ url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, }) - return - - let that = this; - tt.showLoading({ - title: "加载中..." - }); - that.setData({ - showbutton: true, - showbutton1: true - }) - Http.get({ - url: config.api.checkUserStatus, - data: { - token: app.globalData.token - } - }).then(res => { - Http.get({ - url: config.api.checkPhoneStatus, - data: {} - }).then(res => { - - if ((!tt.canIUse('createOrder')) || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) { - //积分券和免费券 - // 发起砍价 - if (discount == 'discount') { - var data = { - couponChannelId: "" + that.data.couponChannelId, - couponId: "" + that.data.couponId, - formId: "" + that.data.formId, - press: true - } - } else if (discount == 'discount1') { - var data = { - couponChannelId: "" + that.data.couponChannelId, - couponId: "" + that.data.couponId, - formId: "" + that.data.formId, - press: false - } - } else if (that.data.couponChannelId == null) { - var data = { - couponId: "" + that.data.couponId, - formId: "" + that.data.formId, - }; - } else { - var data = { - couponChannelId: "" + that.data.couponChannelId, - couponId: "" + that.data.couponId, - formId: "" + that.data.formId, - } - } - console.log(data, "data") - let url = "" - let tempObj; - let tempArr = [] - if (that.data.data.type == 12) { - url = config.api.couponPackageSave - tempObj = { - signleOrder: { - couponChannelId: "" + that.data.couponChannelId, - couponId: "" + that.data.couponId, - formId: "" + that.data.formId, - }, - count: "1" - } - tempArr.push(tempObj) - } else { - url = config.api.orderSave - } - /** - * orderSave 下单 - */ - Http.post({ - url: url, - data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data - }).then(res => { - if (discount != 'discount') { - if (typeof (res) != "undefined") { - let orderId = "" + res.data.mainOrderId; - that.setData({ - orderId: orderId, - composeOrderType: res.data.composeOrderType - }); - if (res.data.payment > 0) { - // 支付金额不为0 - /** - * 支付订单创建 - */ - Http.post({ - url: config.api.payOrderCreate, - data: { - orderId: orderId, - composeOrderType: res.data.composeOrderType - } - }).then(res => { - var payOrderId = "" + res.data.outOrderNo; - tt.hideLoading(); - tt.pay({ - service: 5, - orderInfo: { - order_id: res.data.orderId, - order_token: res.data.token, - }, - success: res => { - tt.showLoading({ - title: '订单正在处理中...', - }) - if (res.code === 0) { - that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that, that.data.composeOrderType); - if (res.errMsg == "requestPayment:ok") { - /** - * 用户支付成功以后跳转到券包列表 - */ - if (that.data.cardType == 100) { - tt.setStorage({ - key: 'couponNum2', - data: "couponNum2" - }) - } else if (that.data.data.type != 5 && that.data.cardType != 100) { - tt.setStorage({ - key: 'couponNum', - data: "couponNum" - }) - } - } - } - else if (res.code === 1) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付超时', // 内容 - icon: "none" - }); - - } else if (res.code === 2) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付失败', // 内容 - icon: "none" - }); - } else if (res.code === 3) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付关闭', // 内容 - icon: "none" - }); - } else if (res.code === 4) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '支付取消', // 内容 - icon: "none" - }); - } else if (res.code === 9) { - that.setData({ - showbutton: false - }) - tt.hideLoading(); - tt.showToast({ - title: '订单状态开发者自行获取', // 内容 - icon: "none" - }); - } - - }, - fail: res => { - tt.hideLoading(); - /** - * 支付失败,需要更新订单的状态 - */ - that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that, that.data.composeOrderType); - that.setData({ - showbutton: false - }) - return; - }, - complete: res => { } - }); - /// End payment -------- - }) - .catch(err => { - tt.hideLoading(); - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - }) - } else { - // 免费券 - that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); - if (that.data.cardType == 100) { - tt.setStorage({ - key: 'couponNum2', - data: "couponNum2" - }) - } else if (that.data.data.type != "5" && that.data.cardType != 100) { - tt.setStorage({ - key: 'couponNum', - data: "couponNum" - }) - } - } - } - } else { - if (res) { - tt.navigateTo({ - url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.mainOrderId}&composeOrderType=${res.data.composeOrderType}`, - }) - } - } - }) - } else { - //有价券 - console.log(tt.canIUse('createOrder'), "是否支持2.0js-api"); - if (tt.canIUse('createOrder')) { - //支持 支付2.0 js-api - let tempCallbackData = {} - tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id - let options = { - callbackData: tempCallbackData, - goodsList: [ - { - quantity: 1, // 购买数量 必填 - price: that.data.priceAndStockObj.salePrice, // 商品价格 必填 + // return - goodsName: that.data.data.title, // 商品名称 必填 - goodsPhoto: that.data.data.coverImg, // 商品图片链接 必填 - goodsId: that.data.data.couponChannel.ttSpuId, // 商品ID 必填 - goodsType: 1, // 商品类型 必填 - goodsLabels: ['过期退', '随时退', '免预约'], // 商品标签 非必填 - dateRule: '', // 使用规则 非必填 - }, - ], - payment: { - totalAmount: that.data.priceAndStockObj.salePrice, // 订单总价 必填 - }, - success: res => { - tt.hideLoading(); - that.setData({ - showbutton: false, - showbutton1: false - }) - const { orderId, outOrderNo } = res; - that.setData({ orderId, outOrderNo }); - that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); - }, - fail: res => { - const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; - if (errLogId) { - tt.hideLoading(); - that.setData({ - showbutton: false, - showbutton1: false - }) - console.log('预下单失败', errNo, errMsg, errLogId); - } - if (orderId || outOrderNo) { - tt.hideLoading(); - that.setData({ - showbutton: false, - showbutton1: false - }) - console.log('支付失败', errNo, errMsg, orderId, outOrderNo); - console.log(that.payOrderUpdate, "payOrderUpdate"); - that.payOrderUpdate(outOrderNo,outOrderNo,2,'','fail') - } - }, - } - console.log(options, "options"); - tt.createOrder(options) - } else { - //不支持 支付2.0 js -api - } - } - - }).catch(err => { - tt.hideLoading() - that.setData({ - showbutton: false, - showbutton1: false - }) - if (err.code == 2011) { - tt.showToast({ - title: "商户信息没找到", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 2013) { - tt.showToast({ - title: "商户信息禁用", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3000) { - tt.showToast({ - title: "库存不足", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3001) { - tt.showToast({ - title: "您已超过限购", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3002) { - tt.showToast({ - title: "订单失败", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3003) { - tt.showToast({ - title: "订单不存在", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3004) { - tt.showToast({ - title: "订单不存在", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 4003) { - tt.showToast({ - title: "卡券已作废", - image: './../../../assets/images/fail.png', - duration: 2000, - mask: false - }); - } else if (err.code == 3012) { - that.getUnPaidOrder(that.data.couponId); - } else if (err.code == 11005) { - /** - * 将值传到用户手机号授权的页面 - * - */ - tt.redirectTo({ - url: "/pages/getphoneInfo/index?couponChannelId=" + - that.data.couponChannelId - }); - } else if (err.code == 11006) { - // 用户手机已加密 - tt.redirectTo({ - url: "/pages/phoneinput/phoneinput?couponChannelId=" + - that.data.couponChannelId - }); - } else { - tt.showToast({ - title: err.message, - icon: 'none', - duration: 2000, - mask: false - }); - } - }) - }).catch(err => { - console.log(err) - if (err.code == 11004) { - tt.redirectTo({ - url: `/pages/getuserinfo/getuserinfo?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`, - }) - } else { - tt.showToast({ - title: err.message, - icon: "none", - duration: 2500 - }) - } - }) }, // 获得未支付的订单 getUnPaidOrder(couponId) { diff --git a/pages/coupon/detail/index.ttml b/pages/coupon/detail/index.ttml index a9f54f0..c02fc7e 100644 --- a/pages/coupon/detail/index.ttml +++ b/pages/coupon/detail/index.ttml @@ -133,9 +133,9 @@ - 购买须知 + 购买须知 有效期 - {{validStartDate}}至{{validEndDate}} + • {{validStartDate}}至{{validEndDate}} 可用时间 • 商家营业时间内到店使用 • 周末不支持使用 @@ -145,8 +145,10 @@ • 每个用户限购{{data.useLimitQuantity}}单 预约消费 - • 无需预约,高峰时段可能等位 + • 无需预约,高峰时段可能等位 + • {{data.subscribeSing}} + 适用人数 • 该团购劵最多{{data.rec_person_num_max}}人使用 @@ -156,7 +158,7 @@ • {{data.besides=="false"?'不可以':'可以'}}外带餐食 • {{data.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠 - • {{data.private_room=="false"?'不提供':'提供'}}包间 + • {{data.private_room=="false"?'不可以使用':'可以使用'}}包间 使用规则 {{data.remark}} @@ -212,7 +214,7 @@ - +
@@ -342,7 +344,7 @@ - +