Browse Source

修改支付的问题

master
gaoxs 5 years ago
parent
commit
9570d9732b
  1. 2
      assets/css/style.css
  2. 2
      assets/css/style.css.map
  3. 17
      assets/css/style.less
  4. 2
      components/UserEvaluation.vue
  5. 48
      libs/wechat.js
  6. 11
      manifest.json
  7. BIN
      myappSignKey.keystore
  8. 11
      pages/home/index.vue
  9. 13
      pages/order/OrderSubmission/index.vue
  10. BIN
      static/images/qr.png
  11. 4
      utils/index.js

2
assets/css/style.css

File diff suppressed because one or more lines are too long

2
assets/css/style.css.map

File diff suppressed because one or more lines are too long

17
assets/css/style.less

@ -1147,6 +1147,7 @@ page {
width: 100%;
padding: 0 30rpx;
box-sizing: border-box;
}
.index .header .logo {
@ -1162,7 +1163,8 @@ page {
}
.index .header .search {
width: 100%;
// width: 100%;
flex:1;
box-sizing: border-box;
height: 0.64*100rpx;
background-color: #f7f7f7;
@ -1172,6 +1174,19 @@ page {
color: #bbb;
}
.index .header .qr{
width:0.34*150rpx;
height:0.34*150rpx;
font-size: 0.34*100rpx;
margin-left: 0.16*100rpx;
margin-right: 0.16*100rpx;
}
.index .header .qr image{
width:0.34*150rpx;
height:0.34*150rpx;
}
.index .header .search .iconfont {
font-size: 0.34*100rpx;
margin-right: 0.16*100rpx;

2
components/UserEvaluation.vue

@ -10,7 +10,7 @@
<view class="start" :class="'star' + item.star"></view>
</view>
</view>
<view class="time">{{ dataFormat(item.addTime) }} {{ item.suk }}</view>
<view class="time">{{ dataFormat(item.addTime) }} {{ item.suk||'' }}</view>
<view class="evaluate-infor">{{ item.comment }}</view>
<view class="imgList acea-row">
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">

48
libs/wechat.js

@ -4,44 +4,48 @@ import { getProvider } from "@/utils";
export const weappPay = (option) => {
return new Promise((resolve, reject) => {
// 吊起微信支付
getProvider().then(provider => {
// getProvider('payment').then(provider => {
let orderInfo = {
...option,
timeStamp: option.timestamp + '',
appid: option.appid,
noncestr: option.noncestr,
package: option.package,
partnerid: option.partnerid,
prepayid: option.prepayid,
sign: option.sign,
timestamp: option.timestamp + '',
}
console.log({
provider: provider,
signType: "MD5",
timeStamp: orderInfo.timestamp,
nonceStr: orderInfo.noncestr,
package: orderInfo.prepayid,
signType: "MD5",
paySign: orderInfo.sign,
provider: 'wxpay',
// signType: "MD5",
// timeStamp: orderInfo.timeStamp,
// nonceStr: orderInfo.noncestr,
// package: orderInfo.prepayid,
// signType: "MD5",
// paySign: orderInfo.sign,
orderInfo,
},'发起支付')
}, '发起支付')
// 调用登录接口
uni.requestPayment({
provider: provider,
signType: "MD5",
timeStamp: orderInfo.timeStamp,
nonceStr: orderInfo.noncestr,
package: orderInfo.prepayid,
signType: "MD5",
paySign: orderInfo.sign,
provider: 'wxpay',
// timeStamp: orderInfo.timeStamp,
// nonceStr: orderInfo.noncestr,
// package: orderInfo.prepayid,
// signType: "MD5",
// paySign: orderInfo.sign,
orderInfo,
success: (success) => {
console.log(error)
console.log(success)
uni.showToast({
title: '支付成功', icon: 'success', duration: 2000
title: JSON.stringify(success), icon: 'success', duration: 5000
});
resolve(success)
},
fail: (error) => {
console.log(error)
uni.showToast({ title: '支付失败', icon: 'none', duration: 2000 });
uni.showToast({ title: JSON.stringify(error), icon: 'none', duration: 5000 });
reject(error)
}
})
})
// })
})
}

11
manifest.json

@ -57,23 +57,24 @@
"sdkConfigs" : {
"oauth" : {
"weixin" : {
"appid" : "",
"appsecret" : "",
"appid" : "wx7c84ede33062d1e4",
"appsecret" : "c47ef66d3311194da44e60387d5c1abd",
"UniversalLinks" : ""
}
},
"payment" : {
"weixin" : {
"appid" : "",
"appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : ""
}
},
"share" : {
"weixin" : {
"appid" : "",
"appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : ""
}
}
},
"ad" : {}
}
}
},

BIN
myappSignKey.keystore

Binary file not shown.

11
pages/home/index.vue

@ -5,6 +5,7 @@
<text class="iconfont icon-xiazai5"></text>
搜索商品
</view>
<view class="qr" @click="startQr()"><image src="@/static/images/qr.png" /></view>
</view>
<view class="slider-banner banner">
<swiper indicatorDots="true" v-if="banner.length > 0">
@ -253,7 +254,15 @@ export default {
goGoodsPromotion() {
this.$yrouter.push('/pages/shop/GoodsPromotion/index');
},
setOpenShare: function() {}
setOpenShare: function() {},
startQr:function(){
uni.scanCode({
success:function(res){
console.log(JSON.stringify(res));
}
});
}
}
};
</script>

13
pages/order/OrderSubmission/index.vue

@ -327,6 +327,7 @@
},
mounted: function() {
let that = this;
this.$store.dispatch('USERINFO', true)
that.getCartInfo();
if (that.$yroute.query.pinkid !== undefined)
that.pinkId = that.$yroute.query.pinkid;
@ -535,6 +536,7 @@
});
break;
case "WECHAT_H5_PAY":
// H5
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
@ -546,6 +548,17 @@
}, 100);
break;
case "WECHAT_PAY":
//
weappPay(data.result.jsConfig).then(res => {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
id: data.result.orderId
}
});
});
case "WECHAT_APP_PAY":
// APP
weappPay(data.result.jsConfig).then(res => {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",

BIN
static/images/qr.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

4
utils/index.js

@ -145,11 +145,11 @@ export const replaceLogin = (msg) => {
}
}
export const getProvider = () => {
export const getProvider = (service) => {
return new Promise((resolve, reject) => {
// 获取当前环境的服务商
uni.getProvider({
service: 'oauth',
service: service || 'oauth',
success: function (res) {
// 此处可以排除h5
if (res.provider) {

Loading…
Cancel
Save