Commit cae74365 by 程智春

订阅

parent 7489c404
/*
* @Author: your name
* @Date: 2020-10-21 09:46:59
* @LastEditTime: 2020-10-22 14:09:41
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \mayi-mp-shop\config\dev.env.js
*/
var merge = require('webpack-merge')
var prodEnv = require('./prod.env')
......@@ -9,6 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl
// BASE_URL:"'http://192.168.1.146:3005'",
// BASE_URL:"'http://192.168.1.127:3000'",
BASE_URL:"'https://test-m-shop.mayi888.cn'",
// BASE_URL:"'http://172.16.1.32:3000'",
OLSHOP_URL:'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"',
// OLSHOP_URL:'"https://shop.mayi888.com/innerApi/shopApiService"',
......
<template>
<div>
</div>
</template>
<script>
export default {
onLoad(options){
wx.navigateToMiniProgram({
appId: options.weappAppId,
path: decodeURIComponent(options.weappPage),
// envVersion: 'release',
extraData: options.extraData && JSON.parse(options.extraData),
success(res) {
// 打开成功
}
})
}
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
{}
\ No newline at end of file
......@@ -19,6 +19,8 @@ export default {
// 购买会员卡新页面
options_isCard:'',
options_isCardTitle:'',
batchNumber : '',
totalMoney : ''
};
},
onLoad(options) {
......@@ -27,7 +29,23 @@ export default {
});
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
console.log("onload//",options);
this.options = JSON.parse(options.ordercode);
if(options.batchNumber){
let ordercode = JSON.parse(options.ordercode)
ordercode.orderSn = ''
ordercode.batchNumber = options.batchNumber
this.options = ordercode
this.batchNumber = ordercode.batchNumber
console.log(JSON.parse(options.ordercode).orderSn)
if(JSON.parse(options.ordercode).orderSn){
this.totalMoney = Number(JSON.parse(options.ordercode).orderSn.totalAmount).toFixed(2)
}
// }
console.log(this.totalMoney,'totalMoney')
}else{
this.options = JSON.parse(options.ordercode);
}
this.options_orderType = options.orderType;
this.options_isCard= options.isCard;
this.options_isCardTitle= options.isCardTit;
......@@ -65,7 +83,10 @@ export default {
console.log("支付成功", res, this.options);
const orderSn = this.options.orderSn;
let vm = this
try {
const subscribeMessageObj = this.$store.state.subscribeMessageObj;
if (subscribeMessageObj && Object.keys(subscribeMessageObj).length > 0) {
// TODO 小程序订阅消息埋点
......@@ -85,36 +106,56 @@ export default {
wx.requestSubscribeMessage({
tmplIds: tmplIds,
success(res) {
fn(vm)
console.log("message success response: ", res);
},
fail(res) {
console.log("message fail response: ", res)
}
})
}else{
fn(vm)
}
}else{
console.log('来这里了')
fn(this)
}
} catch (err) {
console.error("subscribeMessage-err", err);
}
this.message = "支付成功";
if(!this.options_isCard){
let query = {
orderSn: this.options.orderSn
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify(
query
)}`
});
}else{
let query = {
cardTitle: this.options_isCardTitle
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify(
query
)}`
});
function fn(_this){
_this.message = "支付成功";
if(!_this.options_isCard){
let query;
if(_this.batchNumber){
query = {
orderSn: _this.options.orderSn,
batchNumber : _this.batchNumber,
multiMerchantsFlag : 1,
totalMoney : _this.totalMoney
};
}else{
query = {
orderSn: _this.options.orderSn
};
}
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify(
query
)}`
});
}else{
let query = {
cardTitle: _this.options_isCardTitle
}
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify(
query
)}`
});
}
}
};
payData.fail = res => {
......@@ -145,6 +186,16 @@ export default {
});
},
toPage() {
console.log('支付失败来这里了',this.batchNumber)
if(this.batchNumber){
let query = {
multiMerchantsFlag : 1
}
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/order/orderList&params=${JSON.stringify(query)}`
});
return
}
let query = {
orderSn: this.options.orderSn,
payList: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment