Commit 48280df8 authored by jyx's avatar jyx

代码优化

parent 113db493
...@@ -71,8 +71,10 @@ ...@@ -71,8 +71,10 @@
</template> </template>
<script> <script>
import common from '@/mixins/common'; import common from '@/mixins/common';
import { message } from '@/utils/fun'; import {
message
} from '@/utils/fun';
export default { export default {
name: 'coinPopup', name: 'coinPopup',
mixins: [common], mixins: [common],
...@@ -186,23 +188,26 @@ ...@@ -186,23 +188,26 @@
}, },
wxVirtuallyPay(wxData, largeType) { wxVirtuallyPay(wxData, largeType) {
// 虚拟支付 // 虚拟支付
let wxParams = wxData.params; let wxParams = wxData.params;
let signDataParams = wxData.params.sigData; let signDataParams = wxData.params.sigData;
// let signDataStr = wxData.params.signDataStr;
let that = this; let that = this;
const SDKVersion = wx.getSystemInfoSync().SDKVersion; const SDKVersion = wx.getSystemInfoSync().SDKVersion;
if (this.compareVersion(SDKVersion, '2.19.2') >= 0 || wx.canIUse('requestVirtualPayment')) { if (this.compareVersion(SDKVersion, '2.19.2') >= 0 || wx.canIUse('requestVirtualPayment')) {
wx.requestVirtualPayment({ wx.requestVirtualPayment({
signData: JSON.stringify({ // signData :signDataStr,
offerId: signDataParams.offerId, signData: JSON.stringify(wxData.params.sigData),
buyQuantity: signDataParams.buyQuantity, // signData: JSON.stringify({
env: signDataParams.env, // offerId: signDataParams.offerId,
currencyType: signDataParams.currencyType, // buyQuantity: signDataParams.buyQuantity,
platform: signDataParams.platform, // env: signDataParams.env,
productId: signDataParams.productId, // currencyType: signDataParams.currencyType,
goodsPrice: signDataParams.goodsPrice, // platform: signDataParams.platform,
outTradeNo: signDataParams.outTradeNo, // productId: signDataParams.productId,
attach: signDataParams.attach, // goodsPrice: signDataParams.goodsPrice,
}), // outTradeNo: signDataParams.outTradeNo,
// attach: signDataParams.attach,
// }),
paySig: wxParams.paySig, paySig: wxParams.paySig,
signature: wxParams.signature, signature: wxParams.signature,
mode: wxParams.mode, mode: wxParams.mode,
...@@ -212,12 +217,12 @@ ...@@ -212,12 +217,12 @@
fail({ fail({
errMsg, errMsg,
errCode errCode
}) { }) {
message.notify(errMsg); message.notify(errMsg);
console.log('虚拟支付异常:errMsg='+errMsg+' errCode='+errCode); console.log('虚拟支付异常:errMsg=' + errMsg + ' errCode=' + errCode);
}, },
}) })
} else { } else {
message.notify('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'); message.notify('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。');
} }
}, },
......
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