Commit 926c386c by 程默

fix

parent fd1aa5ac
......@@ -4,5 +4,6 @@ var prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
OLSHOP_URL:'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"'
OLSHOP_URL:'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"',
IMG_DOMAIN: '"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com"'
})
module.exports = {
NODE_ENV: '"production"'
NODE_ENV: '"production"',
OLSHOP_URL:'"http://shop.mayi888.com"',
IMG_DOMAIN: '"http://cdn.mayi888.com"'
}
......@@ -6,6 +6,7 @@
<script>
import spokesman from "@/api/spokesman.js";
import { serialize } from "@/utils/index";
export default {
data() {
return {
......@@ -29,7 +30,9 @@ export default {
spokesmanRelId: "", //代言人的id
spokesmanBindId: "", //代言人街道id
hasInvitationStatus: 0, // 邀请资格:0-不能够邀请下级,1-能够邀请下级
newHref: ""
newHref: "",
shopName: "",
logoUrl: ""
};
},
onLoad(options) {
......@@ -42,16 +45,18 @@ export default {
this.page = "";
this.params = "";
} else if (options.from && options.from == "h5login") {
//来自h5登录
let params = JSON.parse(options.params);
wx.setStorage({
key: "sessionid",
data: JSON.parse(options.params).sessionid
data: params.sessionid
});
} else if (options.from && options.from == "login") {
//来自登录页面
this.page = decodeURIComponent(options.backpath);
this.params += "&" + decodeURIComponent(options.params);
} else if (options.from && options.from == "logout") {
this.page = "/";
//来自用户登出
wx.removeStorage({
key: "sessionid"
});
......@@ -61,7 +66,7 @@ export default {
} else if (options.from == "wxPay") {
//来自支付页面
this.page = options.backpath;
this.params = this.params + "&orderSn=" + options.params;
this.params += "&" + serialize(options.params);
} else if (options.scene) {
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
......@@ -69,8 +74,8 @@ export default {
var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
console.log("url", this.link + this.page + this.params);
this.getSpokesman();
//获取店铺信息
},
components: {
// card
......@@ -93,11 +98,19 @@ export default {
this.spokesmanBindId = res.data.data.belongToShopId;
}
if (this.spokesmanBindId) {
this.newHref = `&spokesmanGroupId=${this.spokesmanGroupId}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${this.spokesmanRelId}&spokesmanBindId=${this.spokesmanBindId}`;
this.newHref = `&spokesmanGroupId=${
this.spokesmanGroupId
}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${
this.spokesmanRelId
}&spokesmanBindId=${this.spokesmanBindId}`;
} else {
this.newHref = `&spokesmanGroupId=${this.spokesmanGroupId}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${this.spokesmanRelId}`;
}
this.newHref = `&spokesmanGroupId=${
this.spokesmanGroupId
}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${
this.spokesmanRelId
}`;
}
}
console.log(this.newHref, "this.newHrefthis.newHrefthis.newHref");
}
});
......@@ -116,6 +129,10 @@ export default {
},
getMessage(res) {
console.log("h5消息", res);
if (res.target.data[0].code == 200) {
this.shopName = res.target.data[0].data.shopName;
this.logoUrl = process.env.IMG_DOMAIN + res.target.data[0].data.logoUrl;
}
}
},
onUnload() {
......@@ -134,25 +151,25 @@ export default {
// }
// }
},
async onShareAppMessage(res) {
await this.getSpokesman();
//获取webview当前页面地址
onShareAppMessage(res) {
this.shareUrl = res.webViewUrl + this.newHref;
console.log("share", res, this.shareUrl);
return {
title: this.shareUrl, // 默认是小程序的名称
title: this.shopName, // 默认是小程序的名称
path: `/pages/index/main?share=${encodeURIComponent(this.shareUrl)}`, // 默认是当前页面
imageUrl:
"http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/026da85e-d78d-4260-bbe1-4ca5e1fed10d.png", //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
imageUrl: this.logoUrl,
// "http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/026da85e-d78d-4260-bbe1-4ca5e1fed10d.png", //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function(res) {
// 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") {
consol.log(res, "分享成功");
}
},
fail: function() {
// 转发失败之后的回调
if (res.errMsg == "shareAppMessage:fail cancel") {
// 用户取消转发
consol.log(res, "分享失败");
} else if (res.errMsg == "shareAppMessage:fail") {
// 转发失败,其中 detail message 为详细失败信息
}
......
......@@ -44,64 +44,54 @@ export default {
.to_wx_pay(this.options)
.then(res => {
let payData = JSON.parse(res.data.data);
// {
// timestamp: 0, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
// nonceStr: '', // 支付签名随机串,不长于 32 位
// package: '', // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
// signType: '', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// paySign: '', // 支付签名
// success:
// }
payData.success = res => {
console.log("支付成功", res, this.options);
this.message = "支付成功";
let that = this;
let query = {
orderSn: this.options.orderSn
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${
that.options.orderSn
}`
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify(
query
)}`
});
};
payData.fail = res => {
console.log("支付失败", res, this.options.orderSn);
this.message = "支付失败";
let that = this;
console.log(`../index/main?from=wxPay&backpath=/pay/paySuccess&params=${
that.options.orderSn
}`)
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${
that.options.orderSn
}`
});
this.toPage();
};
payData.complete = res => {
if (res.errMsg == "chooseWXPay:cancel") {
console.log("支付取消", this.options);
this.message = "支付取消";
let that = this;
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${
that.options.orderSn
}`
});
this.toPage();
}
};
wx.requestPayment(payData);
})
.catch(err => {});
},
toPage() {
let query = {
orderSn: this.options.orderSn,
payList: true,
orderListToorderDetail: true
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/order/orderDetail&params=${JSON.stringify(
query
)}`
});
}
}
};
</script>
<style>
.domain{
.domain {
text-align: center;
padding-top: 50%;
}
</style>
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