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

2
components/UserEvaluation.vue

@ -10,7 +10,7 @@
<view class="start" :class="'star' + item.star"></view> <view class="start" :class="'star' + item.star"></view>
</view> </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="evaluate-infor">{{ item.comment }}</view>
<view class="imgList acea-row"> <view class="imgList acea-row">
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq"> <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) => { export const weappPay = (option) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 吊起微信支付 // 吊起微信支付
getProvider().then(provider => { // getProvider('payment').then(provider => {
let orderInfo = { let orderInfo = {
...option, appid: option.appid,
timeStamp: option.timestamp + '', noncestr: option.noncestr,
package: option.package,
partnerid: option.partnerid,
prepayid: option.prepayid,
sign: option.sign,
timestamp: option.timestamp + '',
} }
console.log({ console.log({
provider: provider, provider: 'wxpay',
signType: "MD5", // signType: "MD5",
timeStamp: orderInfo.timestamp, // timeStamp: orderInfo.timeStamp,
nonceStr: orderInfo.noncestr, // nonceStr: orderInfo.noncestr,
package: orderInfo.prepayid, // package: orderInfo.prepayid,
signType: "MD5", // signType: "MD5",
paySign: orderInfo.sign, // paySign: orderInfo.sign,
orderInfo, orderInfo,
},'发起支付') }, '发起支付')
// 调用登录接口 // 调用登录接口
uni.requestPayment({ uni.requestPayment({
provider: provider, provider: 'wxpay',
signType: "MD5", // timeStamp: orderInfo.timeStamp,
timeStamp: orderInfo.timeStamp, // nonceStr: orderInfo.noncestr,
nonceStr: orderInfo.noncestr, // package: orderInfo.prepayid,
package: orderInfo.prepayid, // signType: "MD5",
signType: "MD5", // paySign: orderInfo.sign,
paySign: orderInfo.sign,
orderInfo, orderInfo,
success: (success) => { success: (success) => {
console.log(error) console.log(success)
uni.showToast({ uni.showToast({
title: '支付成功', icon: 'success', duration: 2000 title: JSON.stringify(success), icon: 'success', duration: 5000
}); });
resolve(success) resolve(success)
}, },
fail: (error) => { fail: (error) => {
console.log(error) console.log(error)
uni.showToast({ title: '支付失败', icon: 'none', duration: 2000 }); uni.showToast({ title: JSON.stringify(error), icon: 'none', duration: 5000 });
reject(error) reject(error)
} }
}) })
}) // })
}) })
} }

11
manifest.json

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

BIN
myappSignKey.keystore

Binary file not shown.

11
pages/home/index.vue

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

13
pages/order/OrderSubmission/index.vue

@ -327,6 +327,7 @@
}, },
mounted: function() { mounted: function() {
let that = this; let that = this;
this.$store.dispatch('USERINFO', true)
that.getCartInfo(); that.getCartInfo();
if (that.$yroute.query.pinkid !== undefined) if (that.$yroute.query.pinkid !== undefined)
that.pinkId = that.$yroute.query.pinkid; that.pinkId = that.$yroute.query.pinkid;
@ -535,6 +536,7 @@
}); });
break; break;
case "WECHAT_H5_PAY": case "WECHAT_H5_PAY":
// H5
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", path: "/pages/order/OrderDetails/index",
query: { query: {
@ -546,6 +548,17 @@
}, 100); }, 100);
break; break;
case "WECHAT_PAY": 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 => { weappPay(data.result.jsConfig).then(res => {
this.$yrouter.replace({ this.$yrouter.replace({
path: "/pages/order/OrderDetails/index", 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) => { return new Promise((resolve, reject) => {
// 获取当前环境的服务商 // 获取当前环境的服务商
uni.getProvider({ uni.getProvider({
service: 'oauth', service: service || 'oauth',
success: function (res) { success: function (res) {
// 此处可以排除h5 // 此处可以排除h5
if (res.provider) { if (res.provider) {

Loading…
Cancel
Save