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 merge = require('webpack-merge')
var prodEnv = require('./prod.env') var prodEnv = require('./prod.env')
...@@ -9,6 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl ...@@ -9,6 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl
// BASE_URL:"'http://192.168.1.146:3005'", // BASE_URL:"'http://192.168.1.146:3005'",
// BASE_URL:"'http://192.168.1.127:3000'", // BASE_URL:"'http://192.168.1.127:3000'",
BASE_URL:"'https://test-m-shop.mayi888.cn'", 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://test-m-shop.mayi888.cn/innerApi/shopApiService"',
// OLSHOP_URL:'"https://shop.mayi888.com/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 { ...@@ -19,6 +19,8 @@ export default {
// 购买会员卡新页面 // 购买会员卡新页面
options_isCard:'', options_isCard:'',
options_isCardTitle:'', options_isCardTitle:'',
batchNumber : '',
totalMoney : ''
}; };
}, },
onLoad(options) { onLoad(options) {
...@@ -27,7 +29,23 @@ export default { ...@@ -27,7 +29,23 @@ export default {
}); });
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化 Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
console.log("onload//",options); 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_orderType = options.orderType;
this.options_isCard= options.isCard; this.options_isCard= options.isCard;
this.options_isCardTitle= options.isCardTit; this.options_isCardTitle= options.isCardTit;
...@@ -65,7 +83,10 @@ export default { ...@@ -65,7 +83,10 @@ export default {
console.log("支付成功", res, this.options); console.log("支付成功", res, this.options);
const orderSn = this.options.orderSn; const orderSn = this.options.orderSn;
let vm = this
try { try {
const subscribeMessageObj = this.$store.state.subscribeMessageObj; const subscribeMessageObj = this.$store.state.subscribeMessageObj;
if (subscribeMessageObj && Object.keys(subscribeMessageObj).length > 0) { if (subscribeMessageObj && Object.keys(subscribeMessageObj).length > 0) {
// TODO 小程序订阅消息埋点 // TODO 小程序订阅消息埋点
...@@ -85,36 +106,56 @@ export default { ...@@ -85,36 +106,56 @@ export default {
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: tmplIds, tmplIds: tmplIds,
success(res) { success(res) {
fn(vm)
console.log("message success response: ", res); console.log("message success response: ", res);
}, },
fail(res) { fail(res) {
console.log("message fail response: ", res) console.log("message fail response: ", res)
} }
}) })
}else{
fn(vm)
} }
}else{
console.log('来这里了')
fn(this)
} }
} catch (err) { } catch (err) {
console.error("subscribeMessage-err", err); console.error("subscribeMessage-err", err);
} }
this.message = "支付成功"; function fn(_this){
if(!this.options_isCard){ _this.message = "支付成功";
let query = { if(!_this.options_isCard){
orderSn: this.options.orderSn let query;
}; if(_this.batchNumber){
wx.redirectTo({ query = {
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify( orderSn: _this.options.orderSn,
query batchNumber : _this.batchNumber,
)}` multiMerchantsFlag : 1,
}); totalMoney : _this.totalMoney
}else{ };
let query = { }else{
cardTitle: this.options_isCardTitle query = {
}; orderSn: _this.options.orderSn
wx.redirectTo({ };
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify( }
query
)}` 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 => { payData.fail = res => {
...@@ -145,6 +186,16 @@ export default { ...@@ -145,6 +186,16 @@ export default {
}); });
}, },
toPage() { 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 = { let query = {
orderSn: this.options.orderSn, orderSn: this.options.orderSn,
payList: true, 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