交易市场
This commit is contained in:
@@ -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'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
116
pages/market/goods.vue
Normal file
116
pages/market/goods.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="goods-cover">
|
||||
<swiper class="swiper" circular indicator-dots indicator-active-color="#e93340">
|
||||
<swiper-item v-for="(item, index) in cover" :key="index">
|
||||
<view class="swiper-item">
|
||||
<image class="swiper-cover" :src="item" mode="aspectFill" />
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="info-item">
|
||||
<label>锚定商品</label>
|
||||
{{info.name}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>商品规格</label>
|
||||
{{info.skusUnit}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>提供企业</label>
|
||||
{{info.companyName}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>企业诚信</label>
|
||||
{{info.integrity}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>权证销量</label>
|
||||
{{info.sales}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>发布时间</label>
|
||||
{{info.createdAt}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { goods } from '@/apis/interfaces/goods'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
cover: [],
|
||||
info : {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
goods(this.$Route.query.id).then(res => {
|
||||
console.log(res)
|
||||
this.cover = res.pictures
|
||||
this.info = {
|
||||
name : res.name,
|
||||
companyName : res.company.name,
|
||||
createdAt : res.created_at,
|
||||
sales : res.sales,
|
||||
integrity : res.company.integrity,
|
||||
skusUnit : res.skus[0].unit
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 数权
|
||||
.goods-cover{
|
||||
width: 100%;
|
||||
padding-top: 100%;
|
||||
position: relative;
|
||||
background: #f5f5f5;
|
||||
.swiper{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.swiper-item{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.swiper-cover{
|
||||
@extend .swiper-item;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 锚定商品详情
|
||||
.info{
|
||||
background: white;
|
||||
padding: $padding;
|
||||
.info-item{
|
||||
padding-left: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
position: relative;
|
||||
text-align: right;
|
||||
font-size: $title-size-m;
|
||||
@extend .nowrap;
|
||||
label{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 200rpx;
|
||||
text-align: left;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user