Commit 3c7e29ff by 程默

Merge branch 'product_dev' of http://code.mayi888.com/chengmo/mayi-mp-shop into product_dev

parents c457e8e2 2f6cb1db
......@@ -2,8 +2,13 @@ import {requestPOST,requestGET} from "@/utils/request.js";
export default {
getShopInfo(){
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_shop_info`)
}
getShopInfo() {
return requestPOST(`${process.env.OLSHOP_URL}/shop/get_shop_info`);
},
getWxMiniSubscribeMessageConfig() {
return requestPOST(
`${process.env.OLSHOP_URL}/shop/getWxMiniSubscribeMessageConfig`
);
}
};
\ No newline at end of file
......@@ -2,9 +2,11 @@ import {requestPOST,requestPOST1} from "@/utils/request.js";
export default {
to_wx_pay(options) {
return requestPOST1(`${process.env.OLSHOP_URL}/pay/to_wx_pay`, options)
return requestPOST1(`${process.env.OLSHOP_URL}/pay/to_wx_pay`, options);
},
cancelPayment(options) {
return requestPOST1(`${process.env.OLSHOP_URL}/pay/payment_cancel?orderSn=${options}`)
return requestPOST1(
`${process.env.OLSHOP_URL}/pay/payment_cancel?orderSn=${options}`
);
}
}
\ No newline at end of file
};
\ No newline at end of file
......@@ -6,6 +6,7 @@
<script>
import spokesman from "@/api/spokesman.js";
import shop from "@/api/shop.js";
import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
export default {
data() {
......@@ -153,6 +154,24 @@ export default {
// }
// }
// });
// 获取小程序开启的订阅消息配置
shop.getWxMiniSubscribeMessageConfig().then(res => {
if (res.data.code == 200) {
const data = res.data.data;
console.log("wx mini subscribe message data: ", data);
if (data != null) {
const subscribeMessageObj = {};
for (var key in data) {
if(data[key] && data[key].template_id) {
subscribeMessageObj[key] = data[key].template_id;
}
}
this.$store.commit("setSubscribeMessageObj", subscribeMessageObj);
}
}
});
},
checkLogin() {
let getOpenid = wx.getStorageSync("openid");
......
......@@ -52,6 +52,24 @@ export default {
let payData = JSON.parse(res.data.data);
payData.success = res => {
console.log("支付成功", res, this.options);
const orderSn = this.options.orderSn;
try {
if (this.$store.state.subscribeMessageObj && Object.keys(this.$store.state.subscribeMessageObj).length > 0) {
// TODO 小程序订阅消息埋点
wx.requestSubscribeMessage({
      tmplIds: Object.values(this.$store.state.subscribeMessageObj),
      success(res) {
        console.log("message success response: ", res);
      },
fail(res) {
        console.log("message fail response: ", res)
      }
     })
}
} catch (err) {
console.error("subscribeMessage-err", err);
}
this.message = "支付成功";
if(!this.options_isCard){
let query = {
......
......@@ -3,6 +3,9 @@ const mutations = {
for (let [key, val] of Object.entries(obj)) {
state[key] = val;
}
},
setSubscribeMessageObj(state, subscribeMessageObj) {
state.subscribeMessageObj = subscribeMessageObj;
}
}
};
export default mutations
\ No newline at end of file
const state={
spokesmanGroupId:"",
spokesmanShopId:"",
spokesmanRelId:""
}
const state = {
spokesmanGroupId: "",
spokesmanShopId: "",
spokesmanRelId: "",
subscribeMessageObj: {}
};
export default state
\ No newline at end of file
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