交易市场

This commit is contained in:
唐明明
2021-09-18 12:00:49 +08:00
parent 314f43f0cc
commit bab69de284
8 changed files with 22320 additions and 21697 deletions

View File

@@ -7,7 +7,7 @@
<view class="title nowrap">数字权证</view>
<view class="text nowrap">锚定商品{{info.goods.goods_name}}</view>
<view class="text nowrap">提供企业{{info.company.name}}</view>
<view class="text nav-goods nowrap">查看锚定商品信息<uni-icons type="arrowright" size="12" color="#e93340"></uni-icons></view>
<view class="text nav-goods nowrap" @click="onGoods">查看锚定商品信息<uni-icons type="arrowright" size="12" color="#e93340"></uni-icons></view>
</view>
<view class="info">
<view class="info-item">
@@ -65,7 +65,7 @@
<label>
<radio class="pay-radio" value="eb" checked color="#e93340" />
<view class="pay-title">易货额支付</view>
<view class="pay-sub-title">可用10冻结10</view>
<view class="pay-sub-title">可用{{account.eb}}冻结{{account.frozenEb}}</view>
</label>
</view>
<view class="item">
@@ -91,11 +91,15 @@
price : '0.00',
stock : 1,
loding : true,
info : {}
info : {},
account : {
eb : '0.00',
frozenEb: '0.00'
}
};
},
created() {
marketsInfo(5).then(res =>{
marketsInfo(this.$Route.query.marketId || 5).then(res =>{
this.info = res
this.price = res.price
this.loding = false
@@ -107,6 +111,10 @@
})
},
methods:{
// 查看锚定产品
onGoods(){
this.$Router.push({name: 'marketGoods', params: { id: this.info.goods.goods_id }})
},
// 选择购买方式
payType(e){
this.payValue = e.detail.value
@@ -121,9 +129,10 @@
},
// 提交购买单
buy(){
marketsBuy(5, {
marketsBuy(this.info.market_id, {
qty: this.stock
}).then(res => {
this.account = res.account
this.orderNo = res.market_order_no
this.$refs.buyLay.close()
this.$refs.payLay.open('bottom')
@@ -137,23 +146,38 @@
// 支付
orderPay(){
let data = {}
if(this.payValue === 'wechat'){
data = {
type : 'app',
openid : ''
marketsPay(this.orderNo, this.payValue).then(res => {
switch (this.payValue){
case 'eb':
console.log(res)
console.log('支付结果')
break
case 'wechat':
this.wxPay(JSON.parse(res))
break
}
}
marketsPay(this.info.market_id, this.payValue, {
market_no: this.orderNo,
...data
}).then(res => {
console.log(res)
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 微信支付
wxPay(payConfig){
uni.requestPayment({
provider : 'wxpay',
orderInfo : payConfig,
success : payRes => {
console.log(payRes)
},
fail : payErr => {
uni.showToast({
title: payErr.errMsg,
icon : 'none'
})
}
})
}
}
}