| @@ -33,10 +33,12 @@ App({ | |||||
| } catch (error) { | } catch (error) { | ||||
| console.log(`获取系统信息失败`); | console.log(`获取系统信息失败`); | ||||
| } | } | ||||
| that.logn(); | |||||
| tt.getSystemInfo({ | tt.getSystemInfo({ | ||||
| success(res) { | success(res) { | ||||
| console.log(res,"**"); | |||||
| that.globalData.systemInfo = res | that.globalData.systemInfo = res | ||||
| that.logn(); | |||||
| }, | }, | ||||
| fail(res) { | fail(res) { | ||||
| console.log(`getSystemInfo 调用失败`); | console.log(`getSystemInfo 调用失败`); | ||||
| @@ -75,6 +77,7 @@ App({ | |||||
| tt.login({ | tt.login({ | ||||
| success:(res=>{ | success:(res=>{ | ||||
| let {code} = res | let {code} = res | ||||
| console.log(code,"code"); | |||||
| Http.post({ | Http.post({ | ||||
| url:config.api.login, | url:config.api.login, | ||||
| data:{ | data:{ | ||||
| @@ -36,7 +36,8 @@ | |||||
| "pages/refund/refund", | "pages/refund/refund", | ||||
| "pages/serviceWebView/serviceWebView", | "pages/serviceWebView/serviceWebView", | ||||
| "pages/liveLsit/liveLsit", | "pages/liveLsit/liveLsit", | ||||
| "pages/coupon/confirmation/confirmation" | |||||
| "pages/coupon/confirmation/confirmation", | |||||
| "pages/coupon/instructions/instructions" | |||||
| ], | ], | ||||
| "window": { | "window": { | ||||
| "backgroundTextStyle": "light", | "backgroundTextStyle": "light", | ||||
| @@ -137,6 +137,11 @@ var config = { | |||||
| * 支付订单 | * 支付订单 | ||||
| */ | */ | ||||
| payOrderCreate: "/pay/create", | 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: { | weapp: { | ||||
| AppId: weappId | AppId: weappId | ||||
| @@ -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 | |||||
| } | |||||
| } | } | ||||
| @@ -518,9 +518,7 @@ Page({ | |||||
| * 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
| */ | */ | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(123); | |||||
| let that = this; | let that = this; | ||||
| let optionss; | let optionss; | ||||
| @@ -213,4 +213,5 @@ | |||||
| </navigator> | </navigator> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <tabbar /> | |||||
| <tabbar /> | |||||
| <s-title/> | |||||
| @@ -7,7 +7,7 @@ | |||||
| /* background: #F1F6F7 */ | /* background: #F1F6F7 */ | ||||
| position: relative; | position: relative; | ||||
| background-color: #e6e6e6; | background-color: #e6e6e6; | ||||
| overflow: hidden; | |||||
| } | } | ||||
| .bgImgTop{ | .bgImgTop{ | ||||
| width: 100%; | width: 100%; | ||||
| @@ -6,12 +6,12 @@ const util = require("../../../utils/util"); | |||||
| const imgurl = require("../../../utils/imgurl"); | const imgurl = require("../../../utils/imgurl"); | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| couponIds:"", | |||||
| couponChannelId:"", | |||||
| showPage:false, | |||||
| data:{}, | |||||
| spuIdObj:{}, | |||||
| priceAndStockObj:{} | |||||
| couponIds: "", | |||||
| couponChannelId: "", | |||||
| showPage: false, | |||||
| data: {}, | |||||
| spuIdObj: {}, | |||||
| priceAndStockObj: {} | |||||
| }, | }, | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| console.log(options); | console.log(options); | ||||
| @@ -19,27 +19,37 @@ Page({ | |||||
| title: "加载中..." | title: "加载中..." | ||||
| }); | }); | ||||
| let that = this | 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 => { | app.tokenCallback = token => { | ||||
| that.setData({ | 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) { | getSupId(id) { | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.getSpuid, | url: config.api.getSpuid, | ||||
| @@ -90,191 +100,259 @@ Page({ | |||||
| }; | }; | ||||
| Http.get(parmer).then(res => { | 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({ | 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 { | } 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 { | } 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({ | 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({ | 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) => { | 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; | let that = this; | ||||
| tt.showLoading({ | tt.showLoading({ | ||||
| @@ -293,8 +371,8 @@ Page({ | |||||
| url: config.api.checkPhoneStatus, | url: config.api.checkPhoneStatus, | ||||
| data: {} | data: {} | ||||
| }).then(res => { | }).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') { | if (discount == 'discount') { | ||||
| @@ -357,120 +435,191 @@ Page({ | |||||
| }); | }); | ||||
| if (res.data.payment > 0) { | if (res.data.payment > 0) { | ||||
| // 支付金额不为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.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({ | that.setData({ | ||||
| showbutton: false | 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 { | } else { | ||||
| // 免费券 | // 免费券 | ||||
| that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); | 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 => { | }).catch(err => { | ||||
| tt.hideLoading() | tt.hideLoading() | ||||
| that.setData({ | that.setData({ | ||||
| showbutton: false, | showbutton: false, | ||||
| @@ -625,7 +808,7 @@ Page({ | |||||
| /** | /** | ||||
| * 将值传到用户手机号授权的页面 | * 将值传到用户手机号授权的页面 | ||||
| * | * | ||||
| */ | |||||
| */ | |||||
| tt.navigateTo({ | tt.navigateTo({ | ||||
| url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` | url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` | ||||
| }); | }); | ||||
| @@ -648,7 +831,7 @@ Page({ | |||||
| that.setData({ | that.setData({ | ||||
| showbutton: false, | showbutton: false, | ||||
| }) | }) | ||||
| console.log(err) | |||||
| console.log(err) | |||||
| if (err.code == 11004) { | if (err.code == 11004) { | ||||
| tt.navigateTo({ | tt.navigateTo({ | ||||
| url: `/pages/getuserinfo/getuserinfo?fromflag=confirmation&confirmationFlag=${that.data.couponChannelId}`, | url: `/pages/getuserinfo/getuserinfo?fromflag=confirmation&confirmationFlag=${that.data.couponChannelId}`, | ||||
| @@ -5,15 +5,19 @@ | |||||
| <view class="contentBox"> | <view class="contentBox"> | ||||
| <view class="topBox"> | <view class="topBox"> | ||||
| <view class="title">{{data.title}}</view> | <view class="title">{{data.title}}</view> | ||||
| <view class="unit">¥{{data.salePriceStr}}</view> | |||||
| <view class="unit">{{data.type==50?priceAndStockObj.creditPrice+'积分':'¥'+priceAndStockObj.salePrice/100}}</view> | |||||
| </view> | </view> | ||||
| <view class="subhead"> {{data.subTitle}}</view> | <view class="subhead"> {{data.subTitle}}</view> | ||||
| </view> | </view> | ||||
| <view class="app-border-topX"> | <view class="app-border-topX"> | ||||
| <view class="actually"> 实付 </view> | <view class="actually"> 实付 </view> | ||||
| <view class="payZ">¥</view> | |||||
| <view class="price">{{data.salePriceStr}}</view> | |||||
| <view class="buyX" bindtap="orderFunc">提交订单</view> | |||||
| <view class="payZ">{{data.type!=50?'¥':''}}</view> | |||||
| <view class="price">{{data.type==50?priceAndStockObj.creditPrice+'积分':priceAndStockObj.salePrice/100}}</view> | |||||
| <view class="buyX" bindtap="orderFunc">{{data.type==50?'立即换购':'提交订单'}}</view> | |||||
| </view> | </view> | ||||
| </view> | |||||
| <view class="go" bindtap="goInstructions"> | |||||
| <view class="goTitle">使用须知</view> | |||||
| <image class="goImg" src="../../../assets/itemImg/chevron.png" ></image> | |||||
| </view> | </view> | ||||
| @@ -6,8 +6,8 @@ | |||||
| margin: 10rpx auto; | margin: 10rpx auto; | ||||
| } | } | ||||
| .commodityImgBox{ | .commodityImgBox{ | ||||
| width: 100rpx; | |||||
| height: 100rpx; | |||||
| width: 160rpx; | |||||
| height: 160rpx; | |||||
| overflow: hidden; | overflow: hidden; | ||||
| float: left; | float: left; | ||||
| margin: 20rpx; | margin: 20rpx; | ||||
| @@ -19,7 +19,7 @@ | |||||
| } | } | ||||
| .contentBox{ | .contentBox{ | ||||
| width: 560rpx; | |||||
| width: 500rpx; | |||||
| float: left; | float: left; | ||||
| height: 100rpx; | height: 100rpx; | ||||
| @@ -30,9 +30,9 @@ | |||||
| } | } | ||||
| .title{ | .title{ | ||||
| height: 60rpx; | |||||
| font-size: 26rpx; | |||||
| width: 490rpx; | |||||
| height: 90rpx; | |||||
| font-size: 32rpx; | |||||
| width: 400rpx; | |||||
| float: left; | float: left; | ||||
| text-overflow: ellipsis; | text-overflow: ellipsis; | ||||
| display: -webkit-box; | display: -webkit-box; | ||||
| @@ -42,16 +42,16 @@ | |||||
| } | } | ||||
| .unit{ | .unit{ | ||||
| float: right; | float: right; | ||||
| font-size: 24rpx; | |||||
| font-size: 30rpx; | |||||
| } | } | ||||
| .subhead{ | .subhead{ | ||||
| margin-top: 4rpx; | margin-top: 4rpx; | ||||
| color: #a6a6a6; | color: #a6a6a6; | ||||
| font-size: 20rpx; | |||||
| font-size: 24rpx; | |||||
| } | } | ||||
| .app-border-topX{ | .app-border-topX{ | ||||
| width: 100%; | width: 100%; | ||||
| height: 120rpx; | |||||
| height: 140rpx; | |||||
| background-color: #fff; | background-color: #fff; | ||||
| overflow: hidden; | overflow: hidden; | ||||
| position: fixed; | position: fixed; | ||||
| @@ -60,22 +60,22 @@ | |||||
| } | } | ||||
| .actually{ | .actually{ | ||||
| margin-left: 10%; | margin-left: 10%; | ||||
| font-size: 24rpx; | |||||
| font-size: 28rpx; | |||||
| color: #a6a6a6; | color: #a6a6a6; | ||||
| line-height: 120rpx; | |||||
| line-height: 140rpx; | |||||
| float: left; | float: left; | ||||
| } | } | ||||
| .payZ{ | .payZ{ | ||||
| margin-left: 6rpx; | margin-left: 6rpx; | ||||
| font-size: 20rpx; | |||||
| font-size: 24rpx; | |||||
| color: #d5af67; | color: #d5af67; | ||||
| line-height: 126rpx; | |||||
| line-height: 144rpx; | |||||
| float: left; | float: left; | ||||
| } | } | ||||
| .price{ | .price{ | ||||
| font-size: 26rpx; | |||||
| font-size: 30rpx; | |||||
| color: #d5af67; | color: #d5af67; | ||||
| line-height: 120rpx; | |||||
| line-height: 140rpx; | |||||
| float: left; | float: left; | ||||
| } | } | ||||
| .buyX{ | .buyX{ | ||||
| @@ -84,9 +84,30 @@ | |||||
| /* width: 80rpx; */ | /* width: 80rpx; */ | ||||
| color: #fff; | color: #fff; | ||||
| font-size: 28rpx; | |||||
| font-size: 30rpx; | |||||
| border-radius: 60rpx; | border-radius: 60rpx; | ||||
| margin: 30rpx 40rpx; | 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; | |||||
| } | } | ||||
| @@ -420,97 +420,8 @@ Page({ | |||||
| url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, | url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, | ||||
| }) | }) | ||||
| return | 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) { | setIntervalTime(end_time) { | ||||
| let that = this; | let that = this; | ||||
| var EndTime = end_time; | var EndTime = end_time; | ||||
| @@ -588,6 +499,7 @@ Page({ | |||||
| onshow: false | onshow: false | ||||
| }) | }) | ||||
| if (options && (options.couponChannelId || options.couponIds)) { | if (options && (options.couponChannelId || options.couponIds)) { | ||||
| if (options.couponIds) { | if (options.couponIds) { | ||||
| this.setData({ | this.setData({ | ||||
| couponIds: options.couponIds | couponIds: options.couponIds | ||||
| @@ -674,7 +586,7 @@ Page({ | |||||
| getCouponMerchant(couponChannelId) {//获取适用门店 | getCouponMerchant(couponChannelId) {//获取适用门店 | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.couponMerchant, | url: config.api.couponMerchant, | ||||
| data: { | |||||
| data: { | |||||
| couponChannelId: couponChannelId | couponChannelId: couponChannelId | ||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| @@ -700,6 +612,7 @@ Page({ | |||||
| let data = {}; | let data = {}; | ||||
| that.getCouponMerchant(couponChannelId);//获取适用门店 | that.getCouponMerchant(couponChannelId);//获取适用门店 | ||||
| that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 | that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 | ||||
| if (that.data.couponIds) { | if (that.data.couponIds) { | ||||
| data.couponId = couponChannelId | data.couponId = couponChannelId | ||||
| } else { | } else { | ||||
| @@ -771,7 +684,7 @@ Page({ | |||||
| }); | }); | ||||
| var EndTime = res.data.validStartDate; | var EndTime = res.data.validStartDate; | ||||
| var NowTime = new Date().getTime(); | var NowTime = new Date().getTime(); | ||||
| /** | /** | ||||
| * activityStatus==0 活动未开始 | * activityStatus==0 活动未开始 | ||||
| * activityStatus==1 活动已开始 | * activityStatus==1 活动已开始 | ||||
| @@ -843,6 +756,8 @@ Page({ | |||||
| } | } | ||||
| } | } | ||||
| if (res.data.itemGroup) { | if (res.data.itemGroup) { | ||||
| let tempObj = this.data.data | let tempObj = this.data.data | ||||
| tempObj.itemGroup = JSON.parse(tempObj.itemGroup) | tempObj.itemGroup = JSON.parse(tempObj.itemGroup) | ||||
| @@ -857,6 +772,21 @@ Page({ | |||||
| tempObj.productAttrs = JSON.parse(tempObj.productAttrs) | tempObj.productAttrs = JSON.parse(tempObj.productAttrs) | ||||
| tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs) | tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs) | ||||
| tempObj.productAttrs.map(item => { | 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.key == "Notification") { | ||||
| if (item.data != '') { | if (item.data != '') { | ||||
| tempObj.curLsit = JSON.parse(item.data) | tempObj.curLsit = JSON.parse(item.data) | ||||
| @@ -887,12 +817,9 @@ Page({ | |||||
| tempObj.can_no_use_date = JSON.parse(item.data) | tempObj.can_no_use_date = JSON.parse(item.data) | ||||
| } | } | ||||
| }) | }) | ||||
| tempObj.skuAttrs.map(item => { | tempObj.skuAttrs.map(item => { | ||||
| if (item.key == "commodity") { | |||||
| if (item.data != '') { | |||||
| if (item.key == "commodity"&&item.data) { | |||||
| tempObj.itemGroup = JSON.parse(item.data) | tempObj.itemGroup = JSON.parse(item.data) | ||||
| } | |||||
| } | } | ||||
| }) | }) | ||||
| this.setData({ | this.setData({ | ||||
| @@ -1003,395 +930,9 @@ Page({ | |||||
| tt.navigateTo({ | tt.navigateTo({ | ||||
| url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`, | 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) { | getUnPaidOrder(couponId) { | ||||
| @@ -133,9 +133,9 @@ | |||||
| <store merchantVoList="{{merchantVoList}}" tt:if="{{data.type!=12}}"></store> | <store merchantVoList="{{merchantVoList}}" tt:if="{{data.type!=12}}"></store> | ||||
| <view class='notes'> | <view class='notes'> | ||||
| <view class="notesH">购买须知</view> | |||||
| <view class="notesH">购买须知</view> | |||||
| <view class="timeText">有效期</view> | <view class="timeText">有效期</view> | ||||
| <view class="Hchild">{{validStartDate}}至{{validEndDate}}</view> | |||||
| <view class="Hchild">• {{validStartDate}}至{{validEndDate}}</view> | |||||
| <view class="timeText">可用时间</view> | <view class="timeText">可用时间</view> | ||||
| <view class="Hchild">• 商家营业时间内到店使用</view> | <view class="Hchild">• 商家营业时间内到店使用</view> | ||||
| <view class="Hchild" tt:if="{{data.can_no_use_date.weekend}}">• 周末不支持使用</view> | <view class="Hchild" tt:if="{{data.can_no_use_date.weekend}}">• 周末不支持使用</view> | ||||
| @@ -145,8 +145,10 @@ | |||||
| <view class="Hchild">• 每个用户限购{{data.useLimitQuantity}}单</view> | <view class="Hchild">• 每个用户限购{{data.useLimitQuantity}}单</view> | ||||
| <view class="timeText">预约消费</view> | <view class="timeText">预约消费</view> | ||||
| <view class="Hchild">• 无需预约,高峰时段可能等位</view> | |||||
| <view class="Hchild" tt:if="{{!data.subscribeSing}}">• 无需预约,高峰时段可能等位</view> | |||||
| <view class="Hchild" tt:if="{{data.subscribeSing}}">• {{data.subscribeSing}}</view> | |||||
| <view class="timeText" tt:if="{{data.rec_person_num_max}}">适用人数</view> | <view class="timeText" tt:if="{{data.rec_person_num_max}}">适用人数</view> | ||||
| <view class="Hchild" tt:if="{{data.rec_person_num_max}}">• 该团购劵最多{{data.rec_person_num_max}}人使用</view> | <view class="Hchild" tt:if="{{data.rec_person_num_max}}">• 该团购劵最多{{data.rec_person_num_max}}人使用</view> | ||||
| @@ -156,7 +158,7 @@ | |||||
| <view class="Hchild" tt:if="{{data.besides}}">• {{data.besides=="false"?'不可以':'可以'}}外带餐食</view> | <view class="Hchild" tt:if="{{data.besides}}">• {{data.besides=="false"?'不可以':'可以'}}外带餐食</view> | ||||
| <view class="Hchild" tt:if="{{data.superimposed_discounts}}">• {{data.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠</view> | <view class="Hchild" tt:if="{{data.superimposed_discounts}}">• {{data.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠</view> | ||||
| <view class="Hchild" tt:if="{{data.private_room}}">• {{data.private_room=="false"?'不提供':'提供'}}包间</view> | |||||
| <view class="Hchild" tt:if="{{data.private_room}}">• {{data.private_room=="false"?'不可以使用':'可以使用'}}包间</view> | |||||
| <view class="notesH">使用规则</view> | <view class="notesH">使用规则</view> | ||||
| <text tt:if="{{curHtml==''}}" class="notesText">{{data.remark}}</text> | <text tt:if="{{curHtml==''}}" class="notesText">{{data.remark}}</text> | ||||
| @@ -212,7 +214,7 @@ | |||||
| <button class='buy' disabled='true' tt:if="{{total_micro_second<=0&&data.activityStatus!=0}}">活动已结束</button> | <button class='buy' disabled='true' tt:if="{{total_micro_second<=0&&data.activityStatus!=0}}">活动已结束</button> | ||||
| <button id='noBuy' disabled='true' tt:if="{{data.activityStatus==0}}">活动未开始</button> | <button id='noBuy' disabled='true' tt:if="{{data.activityStatus==0}}">活动未开始</button> | ||||
| </view> | </view> | ||||
| </form> | |||||
| </form> | |||||
| <form data-type='{{data.type}}' report-submit='true' tt:if="{{mouldType==1}}"> | <form data-type='{{data.type}}' report-submit='true' tt:if="{{mouldType==1}}"> | ||||
| <view class="app-border-topX" style="position:fixed;z-index:{{zIndex}}; bottom: 0;"> | <view class="app-border-topX" style="position:fixed;z-index:{{zIndex}}; bottom: 0;"> | ||||
| @@ -342,7 +344,7 @@ | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="shootBox" tt:if="{{spuIdObj.status==1}}"> | |||||
| <view class="shootBox" tt:if="{{spuIdObj.lastStatus==4}}"> | |||||
| <button class="mount" open-type="share" data-channel="video"> | <button class="mount" open-type="share" data-channel="video"> | ||||
| <image src="../../../assets/images/shoot.png" class="videoCla"/> | <image src="../../../assets/images/shoot.png" class="videoCla"/> | ||||
| <view class="issue">发布视频</view> | <view class="issue">发布视频</view> | ||||
| @@ -0,0 +1,197 @@ | |||||
| const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px' | |||||
| var config = require("../../../config/config.js"); | |||||
| var app = getApp(); | |||||
| const Http = require("../../../utils/HttpBasics"); | |||||
| const util = require("../../../utils/util"); | |||||
| const imgurl = require("../../../utils/imgurl"); | |||||
| Page({ | |||||
| data: { | |||||
| couponIds:"", | |||||
| couponChannelId:"", | |||||
| showPage:false, | |||||
| data:{}, | |||||
| spuIdObj:{}, | |||||
| priceAndStockObj:{}, | |||||
| validStartDate:"", | |||||
| validEndDate:"", | |||||
| }, | |||||
| onLoad: function (options) { | |||||
| console.log(options.couponChannelId); | |||||
| this.getDetail(options.couponChannelId) | |||||
| }, | |||||
| getDetail: function (couponChannelId, flag) { | |||||
| let that = this; | |||||
| let data = {}; | |||||
| // that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 | |||||
| if (that.data.couponIds) { | |||||
| data.couponId = couponChannelId | |||||
| } else { | |||||
| data.couponChannelId = couponChannelId | |||||
| } | |||||
| var parmer = { | |||||
| url: config.api.newCouponDetail, | |||||
| data: data | |||||
| }; | |||||
| 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({ | |||||
| 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); | |||||
| } 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 { | |||||
| 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 { | |||||
| that.setData({ | |||||
| endtime: util.timechuo(endTime) | |||||
| }); | |||||
| } | |||||
| } | |||||
| } | |||||
| tt.hideLoading(); | |||||
| that.setData({ | |||||
| data: res.data, | |||||
| }); | |||||
| 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) { | |||||
| 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"), | |||||
| }); | |||||
| } 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.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 == "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) | |||||
| } | |||||
| } | |||||
| 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 == '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) | |||||
| } | |||||
| } | |||||
| }) | |||||
| this.setData({ | |||||
| data: tempObj | |||||
| }) | |||||
| console.log(this.data.data, "data"); | |||||
| } | |||||
| }).catch(err => { | |||||
| tt.showToast({ | |||||
| title: err.message, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }, | |||||
| }) | |||||
| @@ -0,0 +1,12 @@ | |||||
| { | |||||
| "usingComponents": { | |||||
| "navbar": "../../../components/navbar/navbar", | |||||
| "store": "../../../components/store/index", | |||||
| "c-coupons": "../../../components/coupons/index", | |||||
| "phoen":"../../../components/getPhoen/getPhoen" | |||||
| }, | |||||
| "navigationBarTitleText": "使用须知", | |||||
| "backgroundColor":"#f4f4f4", | |||||
| "navigationBarBackgroundColor": "#fff", | |||||
| "navigationBarTextStyle": "black" | |||||
| } | |||||
| @@ -0,0 +1,39 @@ | |||||
| <view class='notes'> | |||||
| <view class="notesH">购买须知</view> | |||||
| <view class="timeText">有效期</view> | |||||
| <view class="Hchild">• {{validStartDate}}至{{validEndDate}}</view> | |||||
| <view class="timeText">可用时间</view> | |||||
| <view class="Hchild">• 商家营业时间内到店使用</view> | |||||
| <view class="Hchild" tt:if="{{data.can_no_use_date.weekend}}">• 周末不支持使用</view> | |||||
| <view class="Hchild" tt:if="{{data.can_no_use_date.HolidaysFlag}}">• 节假日(元旦、春节、清明、劳动节、端午节、中秋节、国庆节、情人节、圣诞节)不支持使用</view> | |||||
| <view class="timeText">购买限制</view> | |||||
| <view class="Hchild">• 每个用户限购{{data.useLimitQuantity}}单</view> | |||||
| <view class="timeText">预约消费</view> | |||||
| <!-- <view class="Hchild">• 无需预约,高峰时段可能等位</view> --> | |||||
| <view class="Hchild" tt:if="{{!data.subscribeSing}}">• 无需预约,高峰时段可能等位</view> | |||||
| <view class="Hchild" tt:if="{{data.subscribeSing}}">• {{data.subscribeSing}}</view> | |||||
| <view class="timeText" tt:if="{{data.rec_person_num_max}}">适用人数</view> | |||||
| <view class="Hchild" tt:if="{{data.rec_person_num_max}}">• 该团购劵最多{{data.rec_person_num_max}}人使用</view> | |||||
| <view class="timeText">温馨提示</view> | |||||
| <view class="Hchild">• 团购券不支持配送或外卖</view> | |||||
| <view class="Hchild" tt:if="{{data.pack}}">• 该团购商品{{data.pack=='false'?'不支持':'支持'}}打包</view> | |||||
| <view class="Hchild" tt:if="{{data.besides}}">• {{data.besides=="false"?'不可以':'可以'}}外带餐食</view> | |||||
| <view class="Hchild" tt:if="{{data.superimposed_discounts}}">• {{data.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠</view> | |||||
| <view class="Hchild" tt:if="{{data.private_room}}">• {{data.private_room=="false"?'不可以使用':'可以使用'}}包间</view> | |||||
| <view class="notesH">使用规则</view> | |||||
| <text tt:if="{{curHtml==''}}" class="notesText">{{data.remark}}</text> | |||||
| <view tt:if="{{curHtml!=''}}"> | |||||
| <rich-text nodes="{{curHtml}}"></rich-text> | |||||
| </view> | |||||
| <view tt:if="{{data.curLsit}}" tt:for="{{data.curLsit}}" tt:key="{{index}}"> | |||||
| <view class="timeText" tt:if="{{item.title!=''}}">{{item.title}}</view> | |||||
| <text class="Hchild">{{item.content}}</text> | |||||
| </view> | |||||
| </view> | |||||
| @@ -6,6 +6,7 @@ const util = require("../../../utils/util"); | |||||
| const QR = require("../../../utils/memberqrcode.js"); | const QR = require("../../../utils/memberqrcode.js"); | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| showIdFalg:false, | |||||
| navigationBarHeight, | navigationBarHeight, | ||||
| couponorderstatus:"", | couponorderstatus:"", | ||||
| quancode:"", | quancode:"", | ||||
| @@ -27,6 +28,36 @@ Page({ | |||||
| templTiem:"", | templTiem:"", | ||||
| curHtml:"", | curHtml:"", | ||||
| }, | }, | ||||
| showId(){ | |||||
| let this_ = this; | |||||
| if(!this_.data.showIdFalg){ | |||||
| tt.showModal({ | |||||
| // title: "查看券码", | |||||
| content: "是否查看完整券码", | |||||
| success(res) { | |||||
| if (res.confirm) { | |||||
| console.log("confirm, continued"); | |||||
| this_.setData({ | |||||
| showIdFalg:true | |||||
| }) | |||||
| } else if (res.cancel) { | |||||
| //取消 | |||||
| console.log("cancel, cold"); | |||||
| } else { | |||||
| // what happend? | |||||
| } | |||||
| }, | |||||
| fail(err) { | |||||
| console.log(`showModal 调用失败`, err); | |||||
| }, | |||||
| }); | |||||
| }else{ | |||||
| this.setData({ | |||||
| showIdFalg:false | |||||
| }) | |||||
| } | |||||
| }, | |||||
| getHtml(couponOrderId) { | getHtml(couponOrderId) { | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.couponHtmlDetailForPkg, | url: config.api.couponHtmlDetailForPkg, | ||||
| @@ -49,6 +80,7 @@ Page({ | |||||
| console.log(options); | console.log(options); | ||||
| that.setData({ | that.setData({ | ||||
| code: options.quancode, | code: options.quancode, | ||||
| codeS: options.quancode.slice(0,4)+`******`+options.quancode.slice(14), | |||||
| couponorderstatus: options.couponorderstatus, | couponorderstatus: options.couponorderstatus, | ||||
| validStatus:options.validStatus | validStatus:options.validStatus | ||||
| }); | }); | ||||
| @@ -37,7 +37,10 @@ | |||||
| <text style="color:red">{{expiredSeconds}}s</text> | <text style="color:red">{{expiredSeconds}}s</text> | ||||
| 后失效 | 后失效 | ||||
| </view> | </view> | ||||
| <view class="barnum">{{code}}</view> | |||||
| <view class="barnum"> | |||||
| <view class="barnumtext">{{showIdFalg?code:codeS}}</view> | |||||
| <image class="barnumImg" src="../../../assets/images/password.png" bindtap="showId"></image> | |||||
| </view> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -106,9 +106,20 @@ | |||||
| color: #333; | color: #333; | ||||
| letter-spacing: 0; | letter-spacing: 0; | ||||
| text-align: center; | text-align: center; | ||||
| overflow: hidden; | |||||
| } | |||||
| .barnumtext{ | |||||
| float: left; | |||||
| margin-left: 20rpx; | |||||
| font-size: 30rpx; | |||||
| } | |||||
| .barnumImg{ | |||||
| float: left; | |||||
| height: 40rpx; | |||||
| width: 40rpx; | |||||
| margin: 24rpx 20rpx; | |||||
| } | } | ||||
| .barnum::before{ | |||||
| .barnumtext::before{ | |||||
| content: "优惠券码:"; | content: "优惠券码:"; | ||||
| font-size: 24rpx; | font-size: 24rpx; | ||||
| color: #999; | color: #999; | ||||
| @@ -234,247 +234,285 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| bindGetUserInfo(e) { | bindGetUserInfo(e) { | ||||
| //session_key 未过期,并且在本生命周期一直有效 | |||||
| tt.getUserInfo({ | |||||
| //session_key 未过期,并且在本生命周期一直有效 tt.getUserProfile | |||||
| tt.getUserProfile({ | |||||
| withCredentials: true, | withCredentials: true, | ||||
| // title: '温馨提示', | |||||
| // desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 | |||||
| title: '温馨提示', | |||||
| desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 | |||||
| success: (res) => { | success: (res) => { | ||||
| let that = this; | let that = this; | ||||
| var iv = res.iv; | var iv = res.iv; | ||||
| var encryptedData = res.encryptedData; | var encryptedData = res.encryptedData; | ||||
| // console.log(res,"数据"); | // console.log(res,"数据"); | ||||
| // return | // return | ||||
| Http.post({ | |||||
| url: config.api.getUserInfo, | |||||
| data: { | |||||
| encryptedData: encryptedData, | |||||
| iv: iv | |||||
| } | |||||
| }).then(res => { | |||||
| if (app.globalData.type == 'gm' && that.data.id && that.data.gameId && that.data.url) {//游戏页面 | |||||
| app.globalData.skipUrl = '/pages/game/index?url=' + that.data.url + "&id=" + that.data.id + "&gameId=" + that.data.gameId, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.wjId) { | |||||
| app.globalData.skipUrl = `/pages/questionnaire/questionnaire?id=${that.data.wjId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.fromflag == 'poster') { | |||||
| app.globalData.skipUrl = `/pages/canvas/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| // | |||||
| if (that.data.optionData != null && that.data.optionData.orderGroupId != null && that.data.optionData.orderGroupId != "") { | |||||
| app.globalData.skipUrl = `/pages/joinFrDpell/index?couponId=${that.data.optionData.couponId}&orderGroupId=${that.data.optionData.orderGroupId}&couponChannelId=${that.data.optionData.couponChannelId}&orderId=${that.data.optionData.orderId}&avatarUrl=${that.data.optionData.avatarUrl}&nickName=${that.data.optionData.nickName}` | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.path == 'index') { | |||||
| app.globalData.skipUrl = "/pages/game/index" | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| //返回主页 | |||||
| // if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup||that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') { | |||||
| if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup && app.globalData.type == 'cd') { | |||||
| // 跳转普通券/消费卡/限时秒杀/砍价详情 | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'navigateTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.couponChannelId && that.data.cuserId && !that.data.spellGroup && app.globalData.type != 'sd') { | |||||
| // 来自转赠 | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}` | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.couponChannelId && app.globalData.type == 'sd' || that.data.couponChannelId && that.data.spellGroup) { | |||||
| // 拼团详情页 | |||||
| app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'gm') { | |||||
| // 游戏页面 | |||||
| that.getGameOne(app.globalData.token, that.data.optionData.id) | |||||
| } else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'td') { | |||||
| app.globalData.skipUrl = `/pages/topicDetail/index?id=${that.data.optionData.id}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 报名活动 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'ra') { | |||||
| app.globalData.skipUrl = `/pages/radetail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 报名签到 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'si') { | |||||
| app.globalData.skipUrl = `/pages/acSignIn/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 门店详情 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'md') { | |||||
| app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 通过分享进入的门店详情页面 | |||||
| else if (that.data.id && that.data.frommd == 'md') { | |||||
| app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.optionData != null && that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') { | |||||
| // 宣传页详情 | |||||
| if (that.data.optionData != null && that.data.optionData.bt == '2') { | |||||
| // 自由图文 | |||||
| app.globalData.skipUrl = `/pages/freeBannerDetail/index?id=${that.data.optionData.id}`, | |||||
| tt.login({ | |||||
| success:(res=>{ | |||||
| let {code} = res | |||||
| console.log(code,"code"); | |||||
| Http.post({ | |||||
| url:config.api.login, | |||||
| data:{ | |||||
| code:code, | |||||
| appId:app.globalData.appId, | |||||
| systemInfo:JSON.stringify(app.globalData.systemInfo) | |||||
| } | |||||
| }).then(res=>{ | |||||
| Http.setToken(res.data.token); | |||||
| app.globalData.token = res.data.token | |||||
| Http.post({ | |||||
| url: config.api.getUserInfo, | |||||
| data: { | |||||
| encryptedData: encryptedData, | |||||
| iv: iv | |||||
| } | |||||
| }).then(res => { | |||||
| if (app.globalData.type == 'gm' && that.data.id && that.data.gameId && that.data.url) {//游戏页面 | |||||
| app.globalData.skipUrl = '/pages/game/index?url=' + that.data.url + "&id=" + that.data.id + "&gameId=" + that.data.gameId, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.wjId) { | |||||
| app.globalData.skipUrl = `/pages/questionnaire/questionnaire?id=${that.data.wjId}` | |||||
| app.globalData.skip = 'redirectTo' | app.globalData.skip = 'redirectTo' | ||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| // 标准格式 | |||||
| app.globalData.skipUrl = `/pages/bannerdetail/index?id=${that.data.optionData.id}`, | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.fromflag == 'poster') { | |||||
| app.globalData.skipUrl = `/pages/canvas/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'redirectTo' | app.globalData.skip = 'redirectTo' | ||||
| that.judgePhonelngo() | |||||
| } | |||||
| } else if (that.data.orderId || that.data.orderId && app.globalData.type == 'bg') { | |||||
| // 参与砍价 | |||||
| app.globalData.skipUrl = `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}&composeOrderType=${that.composeOrderType}`, | |||||
| app.globalData.skip = 'navigateTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'uc') { | |||||
| // 我的 | |||||
| app.globalData.skipUrl = '/index/user', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'in') { | |||||
| // 首页 | |||||
| app.globalData.skipUrl = app.globalData.goHomeUrl, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == "qd") { | |||||
| //每日签到 | |||||
| app.globalData.skipUrl = "/pages/activityCalendar/activityCalendar" | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == "hdrl") { | |||||
| //活动日历 | |||||
| app.globalData.skipUrl = `/pages/radetail/index?id=${app.globalData.activityId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 积分 | |||||
| else if (app.globalData.type == 'jf') { | |||||
| app.globalData.skipUrl = '/pages/integralmall/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'pc') { | |||||
| // 停车 | |||||
| app.globalData.skipUrl = '/index/passCar', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mc') { | |||||
| // 我的券包 | |||||
| app.globalData.skipUrl = '/pages/couponorder/index/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mo') { | |||||
| // 我的订单 | |||||
| app.globalData.skipUrl = '/pages/order/index/index?id=all', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ca') { | |||||
| // 我的卡包 | |||||
| app.globalData.skipUrl = '/pages/cardorder/index/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'sc') { | |||||
| // 特享礼遇 | |||||
| app.globalData.skipUrl = '/pages/specialcourtesy/specialcourtesy', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'rb') { | |||||
| // 限时秒杀 | |||||
| app.globalData.skipUrl = '/pages/rushToBuy/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'bl') { | |||||
| // 砍价专场 | |||||
| app.globalData.skipUrl = '/pages/bargain/bargain', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mb') { | |||||
| // 我的砍价 | |||||
| app.globalData.skipUrl = '/pages/bargain/bargain?from=myhtml', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'sl') { | |||||
| // 拼团专场 | |||||
| app.globalData.skipUrl = '/pages/spellGroup/spellGroup', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ms') { | |||||
| // 我的拼团 | |||||
| app.globalData.skipUrl = '/pages/spellGroup/spellGroup?from=myhtml', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'dc') { | |||||
| // 消费卡 | |||||
| app.globalData.skipUrl = '/pages/discountCardList/discountCardList', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'td') { | |||||
| // 专题活动页 | |||||
| app.globalData.skipUrl = '/pages/topicDetail/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ml') { | |||||
| // 门店 | |||||
| app.globalData.skipUrl = '/index/searchbar', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'confirmation' && that.data.confirmationFlag) { | |||||
| //订单确认 confirmation | |||||
| app.globalData.skipUrl = `/pages/coupon/confirmation/confirmation?couponChannelId=${that.data.confirmationFlag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag) { | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'spellcoupondetail' && that.data.couponChannelIdflag) { | |||||
| app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'fillIndent' && that.data.fillIndentId && that.data.couponId) { | |||||
| //线上配送 填写订单 | |||||
| app.globalData.skipUrl = `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| app.globalData.skipUrl = app.globalData.goHomeUrl, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| } | |||||
| }) | |||||
| .catch(err => { | |||||
| tt.showToast({ | |||||
| title: err.code, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| // | |||||
| if (that.data.optionData != null && that.data.optionData.orderGroupId != null && that.data.optionData.orderGroupId != "") { | |||||
| app.globalData.skipUrl = `/pages/joinFrDpell/index?couponId=${that.data.optionData.couponId}&orderGroupId=${that.data.optionData.orderGroupId}&couponChannelId=${that.data.optionData.couponChannelId}&orderId=${that.data.optionData.orderId}&avatarUrl=${that.data.optionData.avatarUrl}&nickName=${that.data.optionData.nickName}` | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| return; | |||||
| } | |||||
| if (that.data.path == 'index') { | |||||
| app.globalData.skipUrl = "/pages/game/index" | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| //返回主页 | |||||
| // if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup||that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') { | |||||
| if (that.data.couponChannelId && !that.data.cuserId && !that.data.spellGroup && app.globalData.type == 'cd') { | |||||
| // 跳转普通券/消费卡/限时秒杀/砍价详情 | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'navigateTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.couponChannelId && that.data.cuserId && !that.data.spellGroup && app.globalData.type != 'sd') { | |||||
| // 来自转赠 | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}` | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.couponChannelId && app.globalData.type == 'sd' || that.data.couponChannelId && that.data.spellGroup) { | |||||
| // 拼团详情页 | |||||
| app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'gm') { | |||||
| // 游戏页面 | |||||
| that.getGameOne(app.globalData.token, that.data.optionData.id) | |||||
| } else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'td') { | |||||
| app.globalData.skipUrl = `/pages/topicDetail/index?id=${that.data.optionData.id}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 报名活动 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'ra') { | |||||
| app.globalData.skipUrl = `/pages/radetail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 报名签到 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'si') { | |||||
| app.globalData.skipUrl = `/pages/acSignIn/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 门店详情 | |||||
| else if (that.data.optionData != null && that.data.optionData.id && app.globalData.type == 'md') { | |||||
| app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 通过分享进入的门店详情页面 | |||||
| else if (that.data.id && that.data.frommd == 'md') { | |||||
| app.globalData.skipUrl = `/pages/index/searchbar/detail/index?id=${that.data.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.optionData != null && that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') { | |||||
| // 宣传页详情 | |||||
| if (that.data.optionData != null && that.data.optionData.bt == '2') { | |||||
| // 自由图文 | |||||
| app.globalData.skipUrl = `/pages/freeBannerDetail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| // 标准格式 | |||||
| app.globalData.skipUrl = `/pages/bannerdetail/index?id=${that.data.optionData.id}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| } else if (that.data.orderId || that.data.orderId && app.globalData.type == 'bg') { | |||||
| // 参与砍价 | |||||
| app.globalData.skipUrl = `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}&composeOrderType=${that.composeOrderType}`, | |||||
| app.globalData.skip = 'navigateTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'uc') { | |||||
| // 我的 | |||||
| app.globalData.skipUrl = '/index/user', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'in') { | |||||
| // 首页 | |||||
| app.globalData.skipUrl = app.globalData.goHomeUrl, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == "qd") { | |||||
| //每日签到 | |||||
| app.globalData.skipUrl = "/pages/activityCalendar/activityCalendar" | |||||
| app.globalData.skip = 'reLaunch' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == "hdrl") { | |||||
| //活动日历 | |||||
| app.globalData.skipUrl = `/pages/radetail/index?id=${app.globalData.activityId}` | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| // 积分 | |||||
| else if (app.globalData.type == 'jf') { | |||||
| app.globalData.skipUrl = '/pages/integralmall/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'pc') { | |||||
| // 停车 | |||||
| app.globalData.skipUrl = '/index/passCar', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mc') { | |||||
| // 我的券包 | |||||
| app.globalData.skipUrl = '/pages/couponorder/index/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mo') { | |||||
| // 我的订单 | |||||
| app.globalData.skipUrl = '/pages/order/index/index?id=all', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ca') { | |||||
| // 我的卡包 | |||||
| app.globalData.skipUrl = '/pages/cardorder/index/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'sc') { | |||||
| // 特享礼遇 | |||||
| app.globalData.skipUrl = '/pages/specialcourtesy/specialcourtesy', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'rb') { | |||||
| // 限时秒杀 | |||||
| app.globalData.skipUrl = '/pages/rushToBuy/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'bl') { | |||||
| // 砍价专场 | |||||
| app.globalData.skipUrl = '/pages/bargain/bargain', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'mb') { | |||||
| // 我的砍价 | |||||
| app.globalData.skipUrl = '/pages/bargain/bargain?from=myhtml', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'sl') { | |||||
| // 拼团专场 | |||||
| app.globalData.skipUrl = '/pages/spellGroup/spellGroup', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ms') { | |||||
| // 我的拼团 | |||||
| app.globalData.skipUrl = '/pages/spellGroup/spellGroup?from=myhtml', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'dc') { | |||||
| // 消费卡 | |||||
| app.globalData.skipUrl = '/pages/discountCardList/discountCardList', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'td') { | |||||
| // 专题活动页 | |||||
| app.globalData.skipUrl = '/pages/topicDetail/index', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (app.globalData.type == 'ml') { | |||||
| // 门店 | |||||
| app.globalData.skipUrl = '/index/searchbar', | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'confirmation' && that.data.confirmationFlag) { | |||||
| //订单确认 confirmation | |||||
| app.globalData.skipUrl = `/pages/coupon/confirmation/confirmation?couponChannelId=${that.data.confirmationFlag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag) { | |||||
| app.globalData.skipUrl = `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'spellcoupondetail' && that.data.couponChannelIdflag) { | |||||
| app.globalData.skipUrl = `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else if (that.data.fromflag == 'fillIndent' && that.data.fillIndentId && that.data.couponId) { | |||||
| //线上配送 填写订单 | |||||
| app.globalData.skipUrl = `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}`, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } else { | |||||
| app.globalData.skipUrl = app.globalData.goHomeUrl, | |||||
| app.globalData.skip = 'redirectTo' | |||||
| that.judgePhonelngo() | |||||
| } | |||||
| } | |||||
| }) | |||||
| .catch(err => { | |||||
| tt.showToast({ | |||||
| title: err.code, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| }) | |||||
| }).catch(err=>{ | |||||
| console.log(err); | |||||
| tt.showModal({ | |||||
| title: '提示', | |||||
| showCancel: false, | |||||
| content: '登录失败,请重新尝试', | |||||
| success: (res) => { | |||||
| if (res.cancel) { | |||||
| //点击取消,默认隐藏弹框 | |||||
| } else { | |||||
| //点击确定 | |||||
| tt.reLaunch({ | |||||
| url: '/pages/index/index', | |||||
| }) | |||||
| } | |||||
| } | |||||
| }); | |||||
| }) | |||||
| }), | |||||
| }); | |||||
| }, | }, | ||||
| @@ -14,6 +14,17 @@ Page({ | |||||
| businessData: null, | businessData: null, | ||||
| Lsit:[], | Lsit:[], | ||||
| }, | }, | ||||
| goOrder(){ | |||||
| tt.navigateTo({ | |||||
| url: '/pages/order/index/index', | |||||
| success: (res) => { | |||||
| }, | |||||
| fail: (res) => { | |||||
| }, | |||||
| }); | |||||
| }, | |||||
| getCouponChannelList(key) { | getCouponChannelList(key) { | ||||
| if (app.globalData.token) { | if (app.globalData.token) { | ||||
| if (this.data.noDataFlag) { | if (this.data.noDataFlag) { | ||||
| @@ -8,7 +8,12 @@ | |||||
| <view class="imgBox"> | <view class="imgBox"> | ||||
| <image class="img" src="{{item.coverImg}}"> | <image class="img" src="{{item.coverImg}}"> | ||||
| </image> | </image> | ||||
| <view class="explain" tt:if="{{index==0}}"> | |||||
| <image src="../../assets/images/explain.gif" class="explainImg"></image> | |||||
| <view class="explainTitle">讲解中</view> | |||||
| </view> | |||||
| <view class="num">{{index+1}}</view> | <view class="num">{{index+1}}</view> | ||||
| </view> | </view> | ||||
| <view class="dataBox"> | <view class="dataBox"> | ||||
| <view class="titleName">{{item.title}}</view> | <view class="titleName">{{item.title}}</view> | ||||
| @@ -36,6 +41,11 @@ | |||||
| </view> | </view> | ||||
| <view class="upDataBox"> | <view class="upDataBox"> | ||||
| <view class="goderImgBox" bindtap="goOrder"> | |||||
| <image src="../../assets/images/goOder.png" class="goOrder"></image> | |||||
| <view class="goOrderText">我的订单</view> | |||||
| </view> | |||||
| <view class="upData" bindtap="upDataLsit"> 点击刷新</view> | <view class="upData" bindtap="upDataLsit"> 点击刷新</view> | ||||
| </view> | </view> | ||||
| <view class="noDet" tt:if="{{noDataFlag}}">没有更多</view> | <view class="noDet" tt:if="{{noDataFlag}}">没有更多</view> | ||||
| @@ -46,6 +46,28 @@ | |||||
| left: 0; | left: 0; | ||||
| font-size: 24rpx; | font-size: 24rpx; | ||||
| } | } | ||||
| .explain{ | |||||
| position: absolute; | |||||
| bottom: 0rpx; | |||||
| left: 0; | |||||
| z-index: 1000; | |||||
| width: 100%; | |||||
| height: 40rpx; | |||||
| text-align: center; | |||||
| color: #d5af67; | |||||
| background-color: rgba(0, 0, 0, 0.5); | |||||
| font-size: 20rpx; | |||||
| line-height: 40rpx; | |||||
| } | |||||
| .explainImg{ | |||||
| width: 30rpx; | |||||
| height: 30rpx; | |||||
| float: left; | |||||
| margin: 5rpx 5rpx 5rpx 10rpx; | |||||
| } | |||||
| .explainTitle{ | |||||
| float: left; | |||||
| } | |||||
| .img{ | .img{ | ||||
| width: 100%; | width: 100%; | ||||
| height: 100%; | height: 100%; | ||||
| @@ -197,11 +219,29 @@ | |||||
| left: 0; | left: 0; | ||||
| background-color: #fff; | background-color: #fff; | ||||
| height: 120rpx; | height: 120rpx; | ||||
| overflow: hidden; | |||||
| } | |||||
| .goderImgBox{ | |||||
| float: left; | |||||
| margin-top: 10rpx; | |||||
| margin-left: 60rpx; | |||||
| width: 80rpx; | |||||
| overflow: hidden; | |||||
| } | |||||
| .goOrder{ | |||||
| width: 60rpx; | |||||
| height: 60rpx; | |||||
| margin-left: 8rpx; | |||||
| display: block; | |||||
| } | |||||
| .goOrderText{ | |||||
| text-align: center; | |||||
| font-size: 20rpx; | |||||
| color: #d5af67; | |||||
| } | } | ||||
| .upData{ | .upData{ | ||||
| width: 70%; | width: 70%; | ||||
| margin: 10rpx auto 0 auto; | |||||
| margin: 10rpx auto 0 40rpx; | |||||
| text-align: center; | text-align: center; | ||||
| height: 80rpx; | height: 80rpx; | ||||
| @@ -210,4 +250,5 @@ | |||||
| border-radius: 50rpx; | border-radius: 50rpx; | ||||
| color: #d5af67; | color: #d5af67; | ||||
| font-size: 32rpx; | font-size: 32rpx; | ||||
| float: left; | |||||
| } | } | ||||
| @@ -10,7 +10,9 @@ Page({ | |||||
| * 页面的初始数据 | * 页面的初始数据 | ||||
| */ | */ | ||||
| data: { | data: { | ||||
| outOrderNo:'',//支付2.0继续支付id | |||||
| curHtml: '', | |||||
| showIdFalg: false, | |||||
| outOrderNo: '',//支付2.0继续支付id | |||||
| payOrderNo: "",//评价订单id | payOrderNo: "",//评价订单id | ||||
| evaluateFlag: false,//控制评价显隐藏 | evaluateFlag: false,//控制评价显隐藏 | ||||
| serviceUrl: '',//客服外部链接 | serviceUrl: '',//客服外部链接 | ||||
| @@ -49,6 +51,54 @@ Page({ | |||||
| contentType: 0, | contentType: 0, | ||||
| orderFlag: false, //判断是不是线上配送 | orderFlag: false, //判断是不是线上配送 | ||||
| }, | }, | ||||
| handleRefund(event) { | |||||
| const { status, result } = event.detail; | |||||
| if (status === 'success') { | |||||
| const { refundId, outRefundNo } = result; | |||||
| console.log(refundId, outRefundNo ); | |||||
| } else { | |||||
| const { errMsg } = result; | |||||
| console.log(errMsg); | |||||
| } | |||||
| }, | |||||
| applyRefund(event) { | |||||
| const { orderId } = event.detail; | |||||
| const extra = { orderId }; // 开发者需要透传的参数,可自定义内容 | |||||
| return new Promise(resolve => { | |||||
| resolve(extra); | |||||
| }); | |||||
| }, | |||||
| showId() { | |||||
| let this_ = this; | |||||
| if (!this_.data.showIdFalg) { | |||||
| tt.showModal({ | |||||
| // title: "查看券码", | |||||
| content: "是否查看完整券码", | |||||
| success(res) { | |||||
| if (res.confirm) { | |||||
| console.log("confirm, continued"); | |||||
| this_.setData({ | |||||
| showIdFalg: true | |||||
| }) | |||||
| } else if (res.cancel) { | |||||
| //取消 | |||||
| console.log("cancel, cold"); | |||||
| } else { | |||||
| // what happend? | |||||
| } | |||||
| }, | |||||
| fail(err) { | |||||
| console.log(`showModal 调用失败`, err); | |||||
| }, | |||||
| }); | |||||
| } else { | |||||
| this.setData({ | |||||
| showIdFalg: false | |||||
| }) | |||||
| } | |||||
| }, | |||||
| copeCode(e) { | copeCode(e) { | ||||
| let code = e.currentTarget.dataset.text | let code = e.currentTarget.dataset.text | ||||
| tt.setClipboardData({ | tt.setClipboardData({ | ||||
| @@ -163,15 +213,82 @@ Page({ | |||||
| } | } | ||||
| }).then(res => { | }).then(res => { | ||||
| tt.hideLoading(); | tt.hideLoading(); | ||||
| var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd hh:mm:ss"); | |||||
| var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd"); | |||||
| let tempData = res.data.orders[0] | let tempData = res.data.orders[0] | ||||
| tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : "" | tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : "" | ||||
| tempData.itemGroup = tempData.itemGroup ? JSON.parse(tempData.itemGroup) : "" | tempData.itemGroup = tempData.itemGroup ? JSON.parse(tempData.itemGroup) : "" | ||||
| tempData.validStartDate = util.formatTime(tempData.validStartDate, "yyyy-MM-dd") | tempData.validStartDate = util.formatTime(tempData.validStartDate, "yyyy-MM-dd") | ||||
| tempData.validEndDate = util.formatTime(tempData.validEndDate, "yyyy-MM-dd") | tempData.validEndDate = util.formatTime(tempData.validEndDate, "yyyy-MM-dd") | ||||
| tempData.couponOrderIdS = tempData.couponOrderId ? tempData.couponOrderId.slice(0, 4) + `******` + tempData.couponOrderId.slice(14) : '' | |||||
| if (tempData.productAttrs && tempData.skuAttrs) { | |||||
| tempData.productAttrs = JSON.parse(tempData.productAttrs) | |||||
| tempData.skuAttrs = JSON.parse(tempData.skuAttrs) | |||||
| console.log(tempData.productAttrs); | |||||
| console.log(tempData.skuAttrs); | |||||
| console.log('****'); | |||||
| tempData.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}分钟致电商家预约` | |||||
| } | |||||
| tempData.subscribeSing = subscribeSing | |||||
| } | |||||
| } | |||||
| if (item.key == "Notification") { | |||||
| if (item.data != '') { | |||||
| tempData.curLsit = JSON.parse(item.data) | |||||
| } | |||||
| } | |||||
| if (item.key == "bring_out_meal") { | |||||
| tempData.besides = item.data | |||||
| } | |||||
| if (item.key == "free_pack") { | |||||
| tempData.pack = item.data | |||||
| } | |||||
| if (item.key == "superimposed_discounts") { | |||||
| tempData.superimposed_discounts = item.data | |||||
| } | |||||
| if (item.key == "private_room") { | |||||
| tempData.private_room = item.data | |||||
| } | |||||
| if (item.key == "rec_person_num_max") { | |||||
| tempData.rec_person_num_max = item.data | |||||
| } | |||||
| if (item.key == 'Description') { | |||||
| tempData.Description = JSON.parse(item.data) | |||||
| } | |||||
| if (item.key == "can_no_use_date") { | |||||
| tempData.can_no_use_date = JSON.parse(item.data) | |||||
| } | |||||
| }) | |||||
| tempData.skuAttrs.map(item => { | |||||
| if (item.key == "commodity") { | |||||
| if (item.data != '') { | |||||
| tempData.itemGroup = JSON.parse(item.data) | |||||
| } | |||||
| } | |||||
| }) | |||||
| } | |||||
| that.setData({ | that.setData({ | ||||
| outOrderNo:res.data.id, | |||||
| outOrderNo: res.data.id, | |||||
| order: tempData, | order: tempData, | ||||
| showPage: true, | showPage: true, | ||||
| createDate: createDate, | createDate: createDate, | ||||
| @@ -225,15 +342,15 @@ Page({ | |||||
| if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) {//核销后 | if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) {//核销后 | ||||
| that.goIfEvaluate()//判断订单是否能评价 | that.goIfEvaluate()//判断订单是否能评价 | ||||
| } | } | ||||
| }) | |||||
| .catch(error => { | |||||
| tt.hideLoading(); | |||||
| tt.showModal({ | |||||
| title: '提示', | |||||
| content: error.errMsg, | |||||
| showCancel: false | |||||
| }) | |||||
| }).catch(error => { | |||||
| console.log(error, "error"); | |||||
| tt.hideLoading(); | |||||
| tt.showModal({ | |||||
| title: '提示', | |||||
| content: error.errMsg, | |||||
| showCancel: false | |||||
| }) | }) | ||||
| }) | |||||
| }, | }, | ||||
| //确认收货 | //确认收货 | ||||
| verify() { | verify() { | ||||
| @@ -599,8 +716,131 @@ Page({ | |||||
| title: "加载中..." | title: "加载中..." | ||||
| }); | }); | ||||
| if (!tt.canIUse('createOrder')) {//兼容不支持支付2.0 js-api | |||||
| if (that.data.order.payment > 0) { | |||||
| // if (true) {//兼容不支持支付2.0 js-api !tt.canIUse('createOrder') | |||||
| if (that.data.order.payment > 0) { | |||||
| if (tt.canIUse('createOrder')) {//支付2.0 js-api | |||||
| const outOrderNo = that.data.outOrderNo | |||||
| console.log(outOrderNo, "outOrderNo"); | |||||
| Http.post({ | |||||
| url: config.api.payOrderCreate_2, | |||||
| data: { | |||||
| // composeOrderId: outOrderNo | |||||
| orderId: outOrderNo, | |||||
| composeOrderType: that.data.composeOrderType | |||||
| } | |||||
| }).then(res => { | |||||
| if (res.data.createPay) { | |||||
| 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 { | |||||
| tt.continueToPay({ | |||||
| outOrderNo: res.data.outOrderNo, // 外部订单号 2个订单号必填一个 | |||||
| success: res => { | |||||
| // const { orderId, outOrderNo } = res; | |||||
| // console.log('success res', res); | |||||
| // console.log('orderId', orderId, 'outOrderNo', outOrderNo); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.hideLoading(); | |||||
| that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that); // 支付成功 | |||||
| }, | |||||
| fail: res => { | |||||
| const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; | |||||
| if (errLogId) { | |||||
| console.log('查询订单信息失败', errNo, errMsg, errLogId); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.showToast({ | |||||
| title: errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| tt.hideLoading(); | |||||
| } | |||||
| if (orderId || outOrderNo) { | |||||
| console.log('支付失败', errNo, errMsg, orderId, outOrderNo); | |||||
| tt.showToast({ | |||||
| title: errMsg, | |||||
| icon: 'none', | |||||
| duration: 2000, | |||||
| mask: false | |||||
| }); | |||||
| that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail', that); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.hideLoading(); | |||||
| } | |||||
| }, | |||||
| }); | |||||
| } | |||||
| }).catch(err => { | |||||
| tt.showToast({ | |||||
| title: err.message ? err.message : err.data, // 内容 | |||||
| icon: "none" | |||||
| }); | |||||
| }) | |||||
| } else {//不支持支付2.0 js-api | |||||
| tt.showToast({ | |||||
| title: '请升级抖音', // 内容 | |||||
| icon: "none" | |||||
| }); | |||||
| return | |||||
| // 支付金额不为0 | // 支付金额不为0 | ||||
| Http.post({ | Http.post({ | ||||
| url: config.api.payOrderCreate, | url: config.api.payOrderCreate, | ||||
| @@ -614,8 +854,8 @@ Page({ | |||||
| tt.pay({ | tt.pay({ | ||||
| service: 5, | service: 5, | ||||
| orderInfo: { | orderInfo: { | ||||
| order_id: res.data.orderId, | |||||
| order_token: res.data.token, | |||||
| order_id: res.data.payOrderId, | |||||
| order_token: res.data.payOrderToken, | |||||
| }, | }, | ||||
| success: res => { | success: res => { | ||||
| tt.showLoading({ | tt.showLoading({ | ||||
| @@ -707,61 +947,32 @@ Page({ | |||||
| showCancel: false | showCancel: false | ||||
| }) | }) | ||||
| }); | }); | ||||
| } else { | |||||
| // 免费券 | |||||
| that.payOrderUpdate(orderId, "0", 1, '', 'free') // 支付成功 | |||||
| if (that.data.order.type == 100) { | |||||
| tt.setStorage({ | |||||
| key: 'couponNum2', | |||||
| data: "couponNum2" | |||||
| }) | |||||
| } else if (that.data.order.type != "5") { | |||||
| tt.setStorage({ | |||||
| key: 'couponNum', | |||||
| data: "couponNum" | |||||
| }) | |||||
| } | |||||
| tt.showToast({ | |||||
| title: "支付成功", | |||||
| duration: 2000, | |||||
| image: imgurl.success.url, | |||||
| }); | |||||
| } | } | ||||
| }else{//支持 支付2.0 js-api | |||||
| const outOrderNo = that.data.outOrderNo | |||||
| console.log(outOrderNo,"outOrderNo"); | |||||
| tt.continueToPay({ | |||||
| outOrderNo: outOrderNo, // 外部订单号 2个订单号必填一个 | |||||
| success: res => { | |||||
| const { orderId, outOrderNo } = res; | |||||
| console.log('success res', res); | |||||
| console.log('orderId', orderId, 'outOrderNo', outOrderNo); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.hideLoading(); | |||||
| that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that); // 支付成功 | |||||
| }, | |||||
| fail: res => { | |||||
| const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; | |||||
| if(errLogId){ | |||||
| console.log('查询订单信息失败',errNo, errMsg, errLogId); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.hideLoading(); | |||||
| } | |||||
| if( orderId || outOrderNo){ | |||||
| console.log('支付失败',errNo, errMsg , orderId, outOrderNo); | |||||
| that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail', that); | |||||
| that.setData({ | |||||
| showButton: false | |||||
| }) | |||||
| tt.hideLoading(); | |||||
| } | |||||
| }, | |||||
| } else { | |||||
| // 免费券 | |||||
| that.payOrderUpdate(orderId, "0", 1, '', 'free') // 支付成功 | |||||
| if (that.data.order.type == 100) { | |||||
| tt.setStorage({ | |||||
| key: 'couponNum2', | |||||
| data: "couponNum2" | |||||
| }) | |||||
| } else if (that.data.order.type != "5") { | |||||
| tt.setStorage({ | |||||
| key: 'couponNum', | |||||
| data: "couponNum" | |||||
| }) | |||||
| } | |||||
| tt.showToast({ | |||||
| title: "支付成功", | |||||
| duration: 2000, | |||||
| image: imgurl.success.url, | |||||
| }); | }); | ||||
| } | } | ||||
| // } else {//支持 支付2.0 js-api | |||||
| // } | |||||
| }, | }, | ||||
| /** | /** | ||||
| @@ -17,7 +17,8 @@ | |||||
| <view class='sectionTit'> | <view class='sectionTit'> | ||||
| <text>{{order.title}}</text> | <text>{{order.title}}</text> | ||||
| </view> | </view> | ||||
| <view class='detail_msg' bindtap="goDetail"> | |||||
| <!-- --> | |||||
| <view class='detail_msg' bindtap="goDetail"> | |||||
| <view class='logo'> | <view class='logo'> | ||||
| <image mode='aspectFill' src='{{order.coverImg}}'></image> | <image mode='aspectFill' src='{{order.coverImg}}'></image> | ||||
| </view> | </view> | ||||
| @@ -38,7 +39,14 @@ | |||||
| <image class="infoArrow" src="{{chevronUrl}}" mode='widthFix'></image> | <image class="infoArrow" src="{{chevronUrl}}" mode='widthFix'></image> | ||||
| <view class="goRefund" catchtap="goRefund" data-id="{{order.id}}" tt:if="{{order.payment!=0&&(order.couponOrderStatus==0||order.couponOrderStatus==3)}}">{{order.couponOrderStatus==0?'申请退款':'退款进度'}}</view> | <view class="goRefund" catchtap="goRefund" data-id="{{order.id}}" tt:if="{{order.payment!=0&&(order.couponOrderStatus==0||order.couponOrderStatus==3)}}">{{order.couponOrderStatus==0?'申请退款':'退款进度'}}</view> | ||||
| </view> | |||||
| <!-- <pay-button | |||||
| class="goRefund" | |||||
| order-status="{{1}}" | |||||
| order-id="ot7122287526357895463" | |||||
| bind:refund="handleRefund" | |||||
| bind:applyrefund="applyRefund" | |||||
| /> | |||||
| </view> --> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -90,7 +98,8 @@ | |||||
| data-validstatus="{{order.validStatus}}" class='dhCode'> | data-validstatus="{{order.validStatus}}" class='dhCode'> | ||||
| <view style="width:86%;clear: both;"> | <view style="width:86%;clear: both;"> | ||||
| <text class="fl">兑换码:</text> | <text class="fl">兑换码:</text> | ||||
| <text class="fr" tt:if="{{order.validStatus!=0}}">{{order.couponOrderId}}</text> | |||||
| <text class="fr" tt:if="{{order.validStatus!=0}}">{{showIdFalg?order.couponOrderId:order.couponOrderIdS}}</text> | |||||
| <image class="barnumImg" src="../../../assets/images/password.png" bindtap="showId"></image> | |||||
| </view> | </view> | ||||
| <view> | <view> | ||||
| <!-- <image class="spcode" src="{{spcodeUrl}}" mode='widthFix'></image> | <!-- <image class="spcode" src="{{spcodeUrl}}" mode='widthFix'></image> | ||||
| @@ -167,21 +176,41 @@ | |||||
| <view class='notes'> | <view class='notes'> | ||||
| <view class="notesH">购买须知</view> | |||||
| <view class="notesH">购买须知</view> | |||||
| <view class="timeText">有效期</view> | <view class="timeText">有效期</view> | ||||
| <view class="Hchild">{{order.validStartDate}}至{{order.validEndDate}}</view> | |||||
| <view class="Hchild">• {{order.validStartDate}}至{{order.validEndDate}}</view> | |||||
| <view class="timeText">可用时间</view> | <view class="timeText">可用时间</view> | ||||
| <view class="Hchild">•商家营业时间可用</view> | |||||
| <view class="Hchild">• 商家营业时间内到店使用</view> | |||||
| <view class="Hchild" tt:if="{{order.can_no_use_date.weekend}}">• 周末不支持使用</view> | |||||
| <view class="Hchild" tt:if="{{order.can_no_use_date.HolidaysFlag}}">• 节假日(元旦、春节、清明、劳动节、端午节、中秋节、国庆节、情人节、圣诞节)不支持使用</view> | |||||
| <view class="timeText">购买限制</view> | |||||
| <view class="Hchild">• 每个用户限购{{order.useLimitQuantity}}单</view> | |||||
| <view class="timeText">预约消费</view> | <view class="timeText">预约消费</view> | ||||
| <view class="Hchild">• 不需预约,高峰时段可能需要排队</view> | |||||
| <view class="Hchild" tt:if="{{!order.subscribeSing}}">• 无需预约,高峰时段可能等位</view> | |||||
| <view class="Hchild" tt:if="{{order.subscribeSing}}">• {{order.subscribeSing}}</view> | |||||
| <view class="timeText" tt:if="{{order.rec_person_num_max}}">适用人数</view> | |||||
| <view class="Hchild" tt:if="{{order.rec_person_num_max}}">• 该团购劵最多{{order.rec_person_num_max}}人使用</view> | |||||
| <view class="timeText">温馨提示</view> | |||||
| <view class="Hchild">• 团购券不支持配送或外卖</view> | <view class="Hchild">• 团购券不支持配送或外卖</view> | ||||
| <view class="timeText">使用规则</view> | |||||
| <text class="notesText">{{order.remark}}</text> | |||||
| <!-- <text tt:if="{{curHtml==''}}" class="notesText">{{order.remark}}</text> --> | |||||
| <!-- <view tt:if="{{curHtml!=''}}"> | |||||
| <rich-text nodes="{{curHtml}}"></rich-text> | |||||
| </view> --> | |||||
| <view class="Hchild" tt:if="{{order.pack}}">• 该团购商品{{order.pack=='false'?'不支持':'支持'}}打包</view> | |||||
| <view class="Hchild" tt:if="{{order.besides}}">• {{order.besides=="false"?'不可以':'可以'}}外带餐食</view> | |||||
| <view class="Hchild" tt:if="{{order.superimposed_discounts}}">• {{order.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠</view> | |||||
| <view class="Hchild" tt:if="{{order.private_room}}">• {{order.private_room=="false"?'不可以使用':'可以使用'}}包间</view> | |||||
| <view class="notesH" tt:if="{{order.curLsit}}">使用规则</view> | |||||
| <view tt:if="{{order.curLsit}}" tt:for="{{order.curLsit}}" tt:key="{{index}}"> | |||||
| <view class="timeText" tt:if="{{item.title!=''}}">{{item.title}}</view> | |||||
| <text class="Hchild">{{item.content}}</text> | |||||
| </view> | |||||
| </view> | </view> | ||||
| <!-- 子券列表 --> | <!-- 子券列表 --> | ||||
| <view class="childList" tt:if="{{order.type==12}}"> | <view class="childList" tt:if="{{order.type==12}}"> | ||||
| <view class="childTitle">礼券:</view> | <view class="childTitle">礼券:</view> | ||||
| @@ -187,6 +187,12 @@ page { | |||||
| padding-right: 5%; | padding-right: 5%; | ||||
| } | } | ||||
| .barnumImg{ | |||||
| float: left; | |||||
| height: 40rpx; | |||||
| width: 40rpx; | |||||
| margin: 24rpx 20rpx; | |||||
| } | |||||
| .classif { | .classif { | ||||
| background: #fff; | background: #fff; | ||||
| width: 100%; | width: 100%; | ||||
| @@ -62,9 +62,9 @@ | |||||
| <text>砍价详情</text> | <text>砍价详情</text> | ||||
| </view> | </view> | ||||
| <view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="cancel" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="cancel"> | |||||
| <!-- <view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="cancel" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="cancel"> | |||||
| <text>取消</text> | <text>取消</text> | ||||
| </view> | |||||
| </view> --> | |||||
| <view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="btnZf" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="gotopay"> | <view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="btnZf" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="gotopay"> | ||||
| <text>去支付</text> | <text>去支付</text> | ||||
| @@ -598,12 +598,79 @@ Page({ | |||||
| if(res.data.itemGroup){ | if(res.data.itemGroup){ | ||||
| let tempObj = this.data.data | |||||
| let tempObj = that.data.data | |||||
| tempObj.itemGroup = JSON.parse(tempObj.itemGroup) | tempObj.itemGroup = JSON.parse(tempObj.itemGroup) | ||||
| this.setData({ | |||||
| that.setData({ | |||||
| data:tempObj | data:tempObj | ||||
| }) | }) | ||||
| console.log(this.data.data,"data"); | |||||
| console.log(that.data.data,"data"); | |||||
| } | |||||
| if (res.data.productAttrs && res.data.skuAttrs) { | |||||
| let tempObj = that.data.data | |||||
| 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) | |||||
| } | |||||
| } | |||||
| 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 == '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) | |||||
| } | |||||
| } | |||||
| }) | |||||
| this.setData({ | |||||
| data: tempObj | |||||
| }) | |||||
| } | } | ||||
| }).catch(err => { | }).catch(err => { | ||||
| tt.showToast({ | tt.showToast({ | ||||
| @@ -114,18 +114,39 @@ | |||||
| <store merchantVoList="{{merchantVoList}}" tt:if="{{data.type!=12}}"></store> | <store merchantVoList="{{merchantVoList}}" tt:if="{{data.type!=12}}"></store> | ||||
| <view class='notes'> | <view class='notes'> | ||||
| <view class="notesH">购买须知</view> | |||||
| <view class="notesH">购买须知</view> | |||||
| <view class="timeText">有效期</view> | <view class="timeText">有效期</view> | ||||
| <view class="Hchild">{{validStartDate}}至{{validEndDate}}</view> | |||||
| <view class="Hchild">• {{validStartDate}}至{{validEndDate}}</view> | |||||
| <view class="timeText">可用时间</view> | <view class="timeText">可用时间</view> | ||||
| <view class="Hchild">•商家营业时间可用</view> | |||||
| <view class="Hchild">• 商家营业时间内到店使用</view> | |||||
| <view class="Hchild" tt:if="{{data.can_no_use_date.weekend}}">• 周末不支持使用</view> | |||||
| <view class="Hchild" tt:if="{{data.can_no_use_date.HolidaysFlag}}">• 节假日(元旦、春节、清明、劳动节、端午节、中秋节、国庆节、情人节、圣诞节)不支持使用</view> | |||||
| <view class="timeText">购买限制</view> | |||||
| <view class="Hchild">• 每个用户限购{{data.useLimitQuantity}}单</view> | |||||
| <view class="timeText">预约消费</view> | <view class="timeText">预约消费</view> | ||||
| <view class="Hchild">• 不需预约,高峰时段可能需要排队</view> | |||||
| <view class="Hchild" tt:if="{{!data.subscribeSing}}">• 无需预约,高峰时段可能等位</view> | |||||
| <view class="Hchild" tt:if="{{data.subscribeSing}}">• {{data.subscribeSing}}</view> | |||||
| <view class="timeText" tt:if="{{data.rec_person_num_max}}">适用人数</view> | |||||
| <view class="Hchild" tt:if="{{data.rec_person_num_max}}">• 该团购劵最多{{data.rec_person_num_max}}人使用</view> | |||||
| <view class="timeText">温馨提示</view> | |||||
| <view class="Hchild">• 团购券不支持配送或外卖</view> | <view class="Hchild">• 团购券不支持配送或外卖</view> | ||||
| <view class="timeText">使用规则</view> | |||||
| <text tt:if="{{curHtml==''}}" class="notesText">{{data.remark}}</text> | |||||
| <view tt:if="{{curHtml!=''}}"> | |||||
| <rich-text nodes="{{curHtml}}"></rich-text> | |||||
| <view class="Hchild" tt:if="{{data.pack}}">• 该团购商品{{data.pack=='false'?'不支持':'支持'}}打包</view> | |||||
| <view class="Hchild" tt:if="{{data.besides}}">• {{data.besides=="false"?'不可以':'可以'}}外带餐食</view> | |||||
| <view class="Hchild" tt:if="{{data.superimposed_discounts}}">• {{data.superimposed_discounts=="false"?'不可以':'可以'}}享受店内其他优惠</view> | |||||
| <view class="Hchild" tt:if="{{data.private_room}}">• {{data.private_room=="false"?'不可以使用':'可以使用'}}包间</view> | |||||
| <view class="notesH" tt:if="{{data.curLsit}}">使用规则</view> | |||||
| <view tt:if="{{data.curLsit}}" tt:for="{{data.curLsit}}" tt:key="{{index}}"> | |||||
| <view class="timeText" tt:if="{{item.title!=''}}">{{item.title}}</view> | |||||
| <text class="Hchild">{{item.content}}</text> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -1,6 +1,6 @@ | |||||
| { | { | ||||
| "setting": { | "setting": { | ||||
| "urlCheck": true, | |||||
| "urlCheck": false, | |||||
| "es6": true, | "es6": true, | ||||
| "newFeature": false, | "newFeature": false, | ||||
| "postcss": false, | "postcss": false, | ||||
| @@ -31,7 +31,16 @@ | |||||
| "id": 1649905362371, | "id": 1649905362371, | ||||
| "name": "add", | "name": "add", | ||||
| "pathName": "pages/main/index", | "pathName": "pages/main/index", | ||||
| "query": "couponChannelId=697253188828323840&type=orderAffirm", | |||||
| "query": "couponChannelId=702061614111186944&type=orderAffirm", | |||||
| "scene": "990001", | |||||
| "launchFrom": "scan", | |||||
| "location": "qr_code" | |||||
| }, | |||||
| { | |||||
| "id": 1657681080086, | |||||
| "name": "手机号授权", | |||||
| "pathName": "pages/main/index", | |||||
| "query": "couponChannelId=710372266050117632&type=cd", | |||||
| "scene": "990001", | "scene": "990001", | ||||
| "launchFrom": "scan", | "launchFrom": "scan", | ||||
| "location": "qr_code" | "location": "qr_code" | ||||