新增打开微信小程序增加开通会员测试环境

This commit is contained in:
唐明明
2021-09-08 10:02:56 +08:00
parent 4f33cdbceb
commit c0ef48f7cf
11 changed files with 319 additions and 205 deletions

View File

@@ -18,7 +18,7 @@
mode="aspectFill"
/>
<view class="item-title nowrap">{{item.name || '-'}}</view>
<view class="item-btn">进店</view>
<view class="item-btn" @click="onOpenWechat(item)">进店</view>
</view>
</block>
</scroll-view>
@@ -49,16 +49,16 @@
</view>
<view class="trading nowrap">累计交易{{item.orders || 0}}</view>
</view>
<view class="btn">进店</view>
<view class="btn" @click="onOpenWechat(item)">进店</view>
</view>
</swiper-item>
</swiper>
<!-- 行业分类 -->
<scroll-view class="industry-tabs" scroll-x>
<view class="industry-item" :class="{'show':index === industryIndex}" v-for="(item, index) in industryBus" :key="index">{{item.title}}</view>
<view class="industry-item" :class="{'show':index === industryIndex}" v-for="(item, index) in industryBus" :key="index" @click="onBusIndustry(index)">{{item.title}}</view>
</scroll-view>
<!-- 商家 -->
<industry-list :list="busList" />
<industry-list :list="busList" @on-industry="onOpenWechat"/>
</block>
<!-- 易货商城 -->
<block v-if="tabIndex === 1">
@@ -193,7 +193,7 @@
console.log(res)
this.recommendBus = res.positions
this.hotBus = res.hot
this.industryBus = [{title: '全部',}, ...res.industries]
this.industryBus = [{title: '全部', industry_id: ''}, ...res.industries]
this.getCompaniesList()
}).catch(err => {
uni.showToast({
@@ -202,9 +202,16 @@
})
})
},
// 企业广场行业
onBusIndustry(index){
this.industryIndex = index
this.getCompaniesList()
},
// 企业列表
getCompaniesList(){
companiesList().then(res => {
companiesList({
industry_id: this.industryBus[this.industryIndex].industry_id
}).then(res => {
this.busList = res.data
this.busPages = res.pages
})
@@ -216,6 +223,11 @@
this.banners = res.banners
this.coupons = res.coupons
this.position = res.positions
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
this.getGoods()
},
@@ -233,6 +245,22 @@
// 易货分类
onClassify(){
this.$Router.push({name: 'goodsList'})
},
// 打开微信小程序
onOpenWechat(e){
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
console.log(val)
if(val.id === weixin){
sweixin = val
return
}
}
sweixin ? sweixin.launchMiniProgram({
id: e.original_id
}):plus.nativeUI.alert('当前环境不支持微信操作!');
})
}
}
}

View File

@@ -77,6 +77,7 @@
},
created() {
goods(this.$Route.query.id || 16).then(res=>{
console.log(res)
this.loding = false
this.goodsObj = res
this.identity = res.identity.id || ''
@@ -95,7 +96,7 @@
name: 'Buy',
params: {
skuId: this.goodsObj.skus[0].sku_id,
type : this.identity
qty : this.goodsObj.skus[0].number
}
})
}

View File

@@ -11,7 +11,7 @@
<view class="title">{{item.title}}</view>
<view class="tool">
<view class="price"><text></text>{{item.price}}</view>
<uni-number-box class="number" :min="1" :value="qty" @change="numberChange"></uni-number-box>
<uni-number-box class="number" :min="item.number" :value="qty" @change="numberChange"></uni-number-box>
</view>
</view>
</view>
@@ -38,7 +38,7 @@
</view>
<!-- 支付方式 -->
<radio-group class="pay-group" @change="payType">
<view class="item" v-if="buyTypeId != 1">
<view class="item">
<label>
<radio class="radio" value="eb" checked color="#c82626" />
<view class="title">易货额支付</view>
@@ -60,7 +60,7 @@
</template>
<script>
import { buy } from '@/apis/interfaces/order'
import { buy, eb } from '@/apis/interfaces/order'
export default {
data() {
return {
@@ -73,17 +73,16 @@
coupons : [],
account : {},
payValue : 'eb',
buyTypeId : ''
}
},
created(){
buy({
goods_sku_id: this.$Route.query.skuId || 23,
qty : this.qty,
type : this.$Route.query.type === 1 ? 2: 1
goods_sku_id: this.$Route.query.skuId,
qty : this.$Route.query.qty,
type : 1
}, 'GET').then(res=>{
this.loding = true
this.buyTypeId = this.$Route.query.type
this.qty = this.$Route.query.qty,
this.payValue = this.$Route.query.type === 1 ? 'wx' : 'eb'
this.detail = res.detail
this.couponPrice = res.coupon_price
@@ -117,10 +116,20 @@
type : this.payValue == 'eb' ? 1 : 2,
remark : 'app订单'
}, 'POST').then(res=>{
uni.showToast({
title: '订单id:' + res.order_no,
icon : 'none'
})
switch (this.payValue){
case 'eb':
this.ebPay(res.order_no)
break;
case 'wx':
this.wxPay(res.order_no)
break;
default:
uni.showToast({
title: '支付方式错误',
icon : 'none'
})
break;
}
}).catch(err =>{
uni.showToast({
title: err.message,
@@ -129,8 +138,25 @@
})
},
// 微信pay
wxPay(){
wxPay(orderNo){
uni.showToast({
title: '微信支付' + orderNo,
icon : 'none'
})
},
// 易币支付
ebPay(orderNo){
eb(orderNo).then(res => {
uni.showModal({
title: '提示',
content: '支付成功,后续优化支付成功后直接转跳我的权证'
})
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
}
}

View File

@@ -87,8 +87,30 @@
openOrder(){
let identitiesId = this.identities[this.tabsIndex].identity_id
vipOrder(identitiesId).then(res => {
let verifyForm = res
this.wechatPay(res.id)
console.log(res.test)
if(!res.test){
let verifyForm = res
this.wechatPay(res.id)
}else{
// 测试环境
uni.showModal({
title : '开通提示',
content : '会员开通成功,是否继续完成企业认证',
showCancel : true,
cancelText : '稍后认证',
confirmText : '立即认证',
success : modalRes => {
if(modalRes.confirm){
this.$Router.replace({name: 'Approve'})
return
}
this.$Router.back()
},
fail(err) {
console.log(err)
}
})
}
}).catch(err =>{
uni.showToast({
title: err.message,