Browse Source

微信支付

devlop
mo-bai 4 years ago
parent
commit
a70d242fc3
7 changed files with 367 additions and 96 deletions
  1. BIN
      .DS_Store
  2. 50
      apis/commonApi.js
  3. 3
      enums/index.js
  4. 4
      env/index.js
  5. 8
      pages.json
  6. 104
      pages/mine/index.vue
  7. 294
      pages/vip-center/index.vue

BIN
.DS_Store

50
apis/commonApi.js

@ -1,6 +1,6 @@
import http from '../utils/http/index.js' import http from '../utils/http/index.js'
import store from '@/store/index' import store from '@/store/index'
import { XAPPID } from '@/enums/index.js'
import { XAPPID, PAY_URL } from '@/enums/index.js'
let areaCache = null let areaCache = null
/** /**
* 获取省市区街道 * 获取省市区街道
@ -32,6 +32,8 @@ function syncStore(res) {
let vipExpireTime = supplierInfo.supplier.vipExpireTime || null let vipExpireTime = supplierInfo.supplier.vipExpireTime || null
let isVip = false let isVip = false
if (vipExpireTime) { if (vipExpireTime) {
// 适配ios时间戳
vipExpireTime = vipExpireTime.replace(/-/g, '/')
let now = new Date().getTime() let now = new Date().getTime()
if (now < new Date(vipExpireTime).getTime()) { if (now < new Date(vipExpireTime).getTime()) {
isVip = true isVip = true
@ -43,13 +45,13 @@ function syncStore(res) {
fddEnterpriseStatus: supplierInfo.fddEnterpriseStatus, fddEnterpriseStatus: supplierInfo.fddEnterpriseStatus,
supplierId: supplierInfo.supplier.id, supplierId: supplierInfo.supplier.id,
isVip, isVip,
vipExpireTime
vipExpireTime,
}) })
let userInfo = { let userInfo = {
name: supplierInfo.employeeName, // 没有企业就没有name, name: supplierInfo.employeeName, // 没有企业就没有name,
userId: res.userId, userId: res.userId,
mobile: res.mobile, mobile: res.mobile,
avatar: null
avatar: null,
} }
store.commit('setUserInfo', userInfo) store.commit('setUserInfo', userInfo)
} else { } else {
@ -57,7 +59,7 @@ function syncStore(res) {
name: '', // 没有企业就没有name, name: '', // 没有企业就没有name,
userId: res.userId, userId: res.userId,
mobile: res.mobile, mobile: res.mobile,
avatar: null
avatar: null,
} }
store.commit('setUserInfo', userInfo) store.commit('setUserInfo', userInfo)
// 移除企业信息 // 移除企业信息
@ -103,7 +105,7 @@ export function getVerifyUrl(data = {}) {
export function getGuaranteeContract(data = {}) { export function getGuaranteeContract(data = {}) {
return http.post({ return http.post({
url: `/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=${data.mallSupplierId}&customerEnterpriseId=${data.customerEnterpriseId}`, url: `/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=${data.mallSupplierId}&customerEnterpriseId=${data.customerEnterpriseId}`,
data
data,
}) })
} }
@ -114,7 +116,7 @@ export function getGuaranteeContract(data = {}) {
export function transformFileToImg(data) { export function transformFileToImg(data) {
return http.get({ return http.get({
url: '/document/get/enterprise-documents/file-image-base64', url: '/document/get/enterprise-documents/file-image-base64',
data: data
data: data,
}) })
} }
@ -125,7 +127,7 @@ export function transformFileToImg(data) {
export function pushCustomerBind(cid, platformType = 'android', appId = XAPPID) { export function pushCustomerBind(cid, platformType = 'android', appId = XAPPID) {
return http.post({ return http.post({
url: '/base-paper-trading/user/binding/geTui/cid', url: '/base-paper-trading/user/binding/geTui/cid',
data: { cid, appId, platformType }
data: { cid, appId, platformType },
}) })
} }
@ -136,7 +138,7 @@ export function pushCustomerBind(cid, platformType = 'android', appId = XAPPID)
export function pushCustomerOff(cid, platformType = 'android', appId = XAPPID) { export function pushCustomerOff(cid, platformType = 'android', appId = XAPPID) {
return http.post({ return http.post({
url: '/base-paper-trading/user/geTui/offline', url: '/base-paper-trading/user/geTui/offline',
data: { cid, appId, platformType }
data: { cid, appId, platformType },
}) })
} }
@ -146,7 +148,7 @@ export function pushCustomerOff(cid, platformType = 'android', appId = XAPPID) {
export function getLicenseOcr(data = {}) { export function getLicenseOcr(data = {}) {
return http.post({ return http.post({
url: '/base-paper-trading/ocr/business-license', url: '/base-paper-trading/ocr/business-license',
data: data
data: data,
}) })
} }
@ -156,7 +158,7 @@ export function getLicenseOcr(data = {}) {
export function getFrontIdCardOcr(data = {}) { export function getFrontIdCardOcr(data = {}) {
return http.post({ return http.post({
url: '/base-paper-trading/ocr/id-card/face', url: '/base-paper-trading/ocr/id-card/face',
data: data
data: data,
}) })
} }
@ -168,6 +170,32 @@ export function getFrontIdCardOcr(data = {}) {
export function checkUpdate(data = {}) { export function checkUpdate(data = {}) {
return http.get({ return http.get({
url: '/base-paper-trading/get/app/version', url: '/base-paper-trading/get/app/version',
data: data
data: data,
})
}
/**
* 纸盘商开通会员,创建订单
* @param {object} data
* @value {string} type
* @value {string} mallSupplierId
*/
export function openVip(data = {}) {
return http.post({
url: `/yyt-uec/supplier/apply/for/vip?type=${data.type}&mallSupplierId=${data.mallSupplierId}`,
data: data,
})
}
/**
* 纸盘商开通会员,真实支付
* @param {object} data
* @value {string} orderId
* @value {string} channelId
*/
export function openVipPay(data = {}) {
return http.post({
url: PAY_URL,
data: data,
}) })
} }

3
enums/index.js

@ -8,6 +8,9 @@ export const H5_URL = `http://shopkeeper${env === 'production' ? '' : '.' + env}
export const H5_URL_STORE = `${H5_URL}/#/pages/store/index?share=true&` export const H5_URL_STORE = `${H5_URL}/#/pages/store/index?share=true&`
export const H5_URL_PAPER = `${H5_URL}/#/pages/paper-details/index?share=true&` export const H5_URL_PAPER = `${H5_URL}/#/pages/paper-details/index?share=true&`
// 统一支付接口
export const PAY_URL = `https://api-client-psc${urlEnv}.qniao.cn/payment-settlement-center/pay`
/** /**
* 账号类型 * 账号类型
*/ */

4
env/index.js

@ -1,8 +1,8 @@
/** /**
* @description 唯一环境变量 * @description 唯一环境变量
*/ */
// const env = 'test'
const env = 'test'
// const env = 'dev' // const env = 'dev'
const env = 'production'
// const env = 'production'
export default env export default env

8
pages.json

@ -348,6 +348,14 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/vip-center/index",
"style": {
"navigationBarTitleText": "会员中心",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {

104
pages/mine/index.vue

@ -129,34 +129,6 @@
<image class="icon" src="/static/imgs/mine/order-icon.png"></image> <image class="icon" src="/static/imgs/mine/order-icon.png"></image>
<text class="label">订单列表</text> <text class="label">订单列表</text>
</view> </view>
<!-- <view class="icon-item">
<image class="icon" src="/static/imgs/mine/contract-icon.png"></image>
<text class="label">服务区域</text>
</view> -->
</view>
</view>
<!-- <view @click="go2('client-credit')">client-credit</view>
<view @click="go2('enterprise-info')">enterprise-info</view> -->
<view class="share-area" v-if="visible">
<view class="close-icon">
<uni-icons @click="closeShare" type="close" size="35" color="white"></uni-icons>
</view>
<view class="share-content">
<view class="flex-col-center-start">
<view class="vip-top flex-col-start-start">
<text class="text">线上开通会员暂未上线</text>
<text class="text">请添加客服开通</text>
</view>
<text style="font-size: 34rpx; margin-top: 44rpx">扫码或添加会员专属客服微信号</text>
<text style="font-size: 34rpx; color: #ff7e3b; margin: 8rpx 0">{{ customerServicer }}</text>
<image
style="width: 250rpx; height: 250rpx; margin-top: 10rpx"
src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/vip-code.png"
></image>
<view class="button flex-row-center-center" @click="copyPhone">
<text class="text">复制微信号</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -187,7 +159,6 @@ export default {
components: { qnDataPicker }, components: { qnDataPicker },
data() { data() {
return { return {
visible: false,
customerServicer: '17606507108', customerServicer: '17606507108',
fddStatus: Object.freeze(fddEnterpriseStatus), fddStatus: Object.freeze(fddEnterpriseStatus),
messageNum: 0, messageNum: 0,
@ -195,23 +166,23 @@ export default {
tradeRange: [ tradeRange: [
{ {
text: '本月', text: '本月',
value: currentMonth.join('~')
value: currentMonth.join('~'),
}, },
{ {
text: '上月', text: '上月',
value: lastMonth.join('~')
value: lastMonth.join('~'),
}, },
{ {
text: '总计', text: '总计',
value: ''
}
value: '',
},
], ],
tradeDate: currentMonth.join('~'), tradeDate: currentMonth.join('~'),
tradeData: { tradeData: {
tradingVolume: 0, tradingVolume: 0,
volumeOfBusiness: 0, volumeOfBusiness: 0,
orderQuantity: 0
}
orderQuantity: 0,
},
} }
}, },
@ -224,7 +195,7 @@ export default {
if (!this.hasCompany) { if (!this.hasCompany) {
uni.showToast({ uni.showToast({
title: '您还没有企业信息,请先完善企业信息', title: '您还没有企业信息,请先完善企业信息',
icon: 'none'
icon: 'none',
}) })
return return
} }
@ -251,7 +222,7 @@ export default {
if (!this.hasCompany) { if (!this.hasCompany) {
uni.showToast({ uni.showToast({
title: '您还没有企业,请先加入企业', title: '您还没有企业,请先加入企业',
icon: 'none'
icon: 'none',
}) })
return return
} }
@ -259,17 +230,14 @@ export default {
}, },
makeVip() { makeVip() {
if (this.hasCompany) { if (this.hasCompany) {
this.visible = true
loginGo2('vip-center')
} else { } else {
uni.showToast({ uni.showToast({
title: '请先完善企业信息', title: '请先完善企业信息',
icon: 'none'
icon: 'none',
}) })
} }
}, },
closeShare() {
this.visible = false
},
// //
copyPhone() { copyPhone() {
uni.setClipboardData({ uni.setClipboardData({
@ -278,9 +246,9 @@ export default {
uni.showToast({ uni.showToast({
title: '复制成功', title: '复制成功',
icon: 'none', icon: 'none',
duration: 2000
duration: 2000,
}) })
}
},
}) })
}, },
// //
@ -295,14 +263,14 @@ export default {
getOrderStatistics({ getOrderStatistics({
beginDate, beginDate,
endDate, endDate,
currentSupplier
currentSupplier,
}).then((res) => { }).then((res) => {
console.log('res', res) console.log('res', res)
if (res) { if (res) {
this.tradeData = res this.tradeData = res
} }
}) })
}
},
}, },
watch: { watch: {
tradeDate(val) { tradeDate(val) {
@ -315,7 +283,7 @@ export default {
this.getStatistics() this.getStatistics()
} }
}, },
immediate: true
immediate: true,
}, },
tradeDate() { tradeDate() {
this.getStatistics() this.getStatistics()
@ -326,10 +294,10 @@ export default {
this.tradeData = { this.tradeData = {
tradingVolume: 0, tradingVolume: 0,
volumeOfBusiness: 0, volumeOfBusiness: 0,
orderQuantity: 0
orderQuantity: 0,
} }
} }
}
},
}, },
computed: { computed: {
vipExpireTime() { vipExpireTime() {
@ -342,6 +310,7 @@ export default {
return this.$store.state.qnToken != '' return this.$store.state.qnToken != ''
}, },
isVip() { isVip() {
console.log('isVip:', this.$store.state.supplierInfo.isVip)
return this.$store.state.supplierInfo.isVip == true return this.$store.state.supplierInfo.isVip == true
}, },
hasCompany() { hasCompany() {
@ -362,9 +331,9 @@ export default {
avatar: this.$store.state.userInfo.avatar || '', avatar: this.$store.state.userInfo.avatar || '',
name: this.$store.state.userInfo.name || this.$store.state.userInfo.mobile || '', name: this.$store.state.userInfo.name || this.$store.state.userInfo.mobile || '',
supplierName: this.$store.state.supplierInfo.name || '', supplierName: this.$store.state.supplierInfo.name || '',
fddEnterpriseStatus: this.$store.state.supplierInfo.fddEnterpriseStatus || 1
fddEnterpriseStatus: this.$store.state.supplierInfo.fddEnterpriseStatus || 1,
} }
}
},
}, },
onLoad() {}, onLoad() {},
onShow() { onShow() {
@ -375,7 +344,7 @@ export default {
} }
}) })
this.hasLogin && this.getStatistics() this.hasLogin && this.getStatistics()
}
},
} }
</script> </script>
@ -647,37 +616,6 @@ export default {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
} }
.share-area {
width: 750rpx;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
position: fixed;
z-index: 200;
top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.close-icon {
width: 750rpx;
padding: 0 32rpx;
height: 70rpx;
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.share-content {
width: 560rpx;
margin-top: 26rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
}
}
.vip-top { .vip-top {
width: 560rpx; width: 560rpx;
height: 268rpx; height: 268rpx;

294
pages/vip-center/index.vue

@ -0,0 +1,294 @@
<template>
<view class="content">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="会员中心"></uni-nav-bar>
<view class="flex-col group_4">
<view class="flex-col">
<view class="flex-col section_1">
<text class="text_4">超级VIP</text>
<view class="flex-col group_6">
<text class="text_5">开通立即尊享</text>
<text class="text_6">{{ money }} /</text>
</view>
</view>
<view class="flex-col group_7">
<view class="flex-col">
<text class="text_7">会员权益</text>
<view class="flex-row equal-division">
<view class="equal-division-item flex-col">
<view class="top-image-wrapper flex-col items-center">
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/611dd17441a9be0011f45822/620ccb0962a7d90011fe5c8f/16456699126307827649.png"
class="image_4"
/>
</view>
<text class="text_8">账期变现</text>
</view>
<view class="equal-division-item flex-col group_10">
<view class="top-image-wrapper flex-col items-center">
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/611dd17441a9be0011f45822/620ccb0962a7d90011fe5c8f/16456699126326656192.png"
class="image_4"
/>
</view>
<text class="text_8">电子签约</text>
</view>
<view class="equal-division-item_1 flex-col">
<view class="flex-col items-center image-wrapper">
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/611dd17441a9be0011f45822/620ccb0962a7d90011fe5c8f/16456699126346194649.png"
class="image_7"
/>
</view>
<text class="text_11">智能合同</text>
</view>
<view class="equal-division-item_1 flex-col">
<view class="top-image-wrapper flex-col items-center">
<image
src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/611dd17441a9be0011f45822/620ccb0962a7d90011fe5c8f/16456699133425037124.png"
class="image_4"
/>
</view>
<text class="text_11">征信管理</text>
</view>
</view>
</view>
<view class="flex-col group_13">
<text class="text_14">服务说明</text>
<text class="text_15">1.纸掌柜会员支付支持微信支付</text>
<text class="text_16">2.支付成功后会员权益立即生效</text>
<text class="text_17">3.会员权益最终解释权归千鸟互联电商科技有限公司所有</text>
</view>
</view>
</view>
<view class="flex-col section_2">
<view class="flex-col items-center button" @click="payForVip">
<text>立即支付</text>
</view>
</view>
</view>
</view>
</template>
<script>
import { back } from '@/utils/hook.js'
import { openVip, openVipPay } from '@/apis/commonApi.js'
export default {
data() {
return {
money: 10000,
}
},
methods: {
back,
payForVip() {
openVip({
mallSupplierId: this.$store.state.supplierInfo.supplierId,
type: 1, //
}).then((res) => {
if (res) {
openVipPay({
tradeOrderId: res.orderId,
channelId: res.channelId,
}).then((info) => {
if (info) {
console.log('info', info)
uni.requestPayment({
provider: 'wxpay',
orderInfo: info.extra,
success: (res) => {
uni.showToast({
title: '支付成功',
icon: 'none',
duration: 1500,
})
setTimeout(() => {
go2('mine', {}, true)
}, 1500)
},
fail: (err) => {
uni.showToast({
title: '支付失败',
icon: 'none',
duration: 1500,
})
},
})
}
})
}
})
},
},
}
</script>
<style lang="scss" scoped>
.content {
width: 750rpx;
}
.group_4 {
flex: 1 1 auto;
overflow-y: auto;
.section_2 {
margin-top: 329rpx;
padding: 28rpx 0 30rpx;
color: rgb(126, 86, 28);
font-size: 36rpx;
font-weight: 500;
line-height: 50rpx;
white-space: nowrap;
background-image: linear-gradient(180deg, rgb(43, 41, 44) 0%, rgb(43, 41, 44) 0%, rgb(60, 58, 52) 100%, rgb(60, 58, 52) 100%);
.button {
margin: 0 32rpx;
padding: 23rpx 0;
background-image: linear-gradient(90deg, rgb(255, 234, 208) 0%, rgb(255, 234, 208) 0%, rgb(255, 206, 144) 100%, rgb(255, 206, 144) 100%);
border-radius: 48rpx;
}
}
.section_1 {
padding: 86rpx 72rpx 63rpx;
background-image: url('https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/611dd17441a9be0011f45822/620ccb0962a7d90011fe5c8f/16456699151285633679.png');
background-position: 0px 0px;
background-size: 100% 100%;
background-repeat: no-repeat;
.text_4 {
color: rgb(237, 221, 187);
font-size: 68rpx;
font-weight: 500;
line-height: 95rpx;
letter-spacing: 3rpx;
white-space: nowrap;
}
.group_6 {
margin-top: 110rpx;
.text_5 {
color: rgb(247, 251, 255);
font-size: 24rpx;
font-weight: 500;
line-height: 33rpx;
white-space: nowrap;
}
.text_6 {
margin-top: 9rpx;
color: rgb(247, 251, 255);
font-size: 60rpx;
font-weight: 500;
line-height: 84rpx;
white-space: nowrap;
}
}
}
.group_7 {
padding-top: 20rpx;
.group_13 {
margin-top: 65rpx;
padding: 0 32rpx;
.text_14 {
color: rgb(51, 51, 51);
font-size: 32rpx;
font-weight: 600;
line-height: 45rpx;
white-space: nowrap;
}
.text_15 {
margin-top: 25rpx;
color: rgb(136, 136, 136);
font-size: 26rpx;
font-weight: 500;
line-height: 37rpx;
letter-spacing: 4rpx;
white-space: nowrap;
}
.text_16 {
margin-top: 17rpx;
color: rgb(136, 136, 136);
font-size: 26rpx;
font-weight: 500;
line-height: 37rpx;
letter-spacing: 4rpx;
white-space: nowrap;
}
.text_17 {
margin-right: 25rpx;
margin-top: 17rpx;
color: rgb(136, 136, 136);
font-size: 26rpx;
font-weight: 500;
line-height: 37rpx;
letter-spacing: 4rpx;
text-align: left;
}
}
.text_7 {
margin-left: 32rpx;
color: rgb(51, 51, 51);
font-size: 40rpx;
font-weight: 500;
line-height: 56rpx;
white-space: nowrap;
}
.equal-division {
margin-top: 32rpx;
color: rgb(85, 85, 85);
font-size: 26rpx;
font-weight: 500;
line-height: 37rpx;
letter-spacing: 4rpx;
white-space: nowrap;
.equal-division-item {
flex: 1 1 168rpx;
padding-left: 28rpx;
padding-right: 20rpx;
.text_8 {
margin-top: 8rpx;
}
}
.group_10 {
margin-left: 26rpx;
}
.equal-division-item_1 {
margin-left: 26rpx;
flex: 1 1 168rpx;
padding-left: 27rpx;
padding-right: 21rpx;
.image-wrapper {
margin: 0 4rpx;
padding: 30rpx 0;
background-image: linear-gradient(
90deg,
rgba(255, 224, 192, 0.6) 0%,
rgba(255, 224, 192, 0.6) 0%,
rgba(243, 193, 130, 0.6) 100%,
rgba(243, 193, 130, 0.6) 100%
);
box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 50%;
.image_7 {
width: 52rpx;
height: 52rpx;
}
}
.text_11 {
margin-top: 8rpx;
}
}
.top-image-wrapper {
margin: 0 4rpx;
padding: 26rpx 0;
background-image: linear-gradient(
90deg,
rgba(255, 224, 192, 0.6) 0%,
rgba(255, 224, 192, 0.6) 0%,
rgba(243, 193, 130, 0.6) 100%,
rgba(243, 193, 130, 0.6) 100%
);
box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 50%;
.image_4 {
width: 60rpx;
height: 60rpx;
}
}
}
}
}
</style>
Loading…
Cancel
Save