转让市场
This commit is contained in:
@@ -174,22 +174,24 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { managesGoodsCreate, managesCreate, managesGoodsEdit } from '@/apis/interfaces/goods'
|
||||
import { managesGoodsCreate, managesCreate, managesGoodsEdit, managesGoodsPut } from '@/apis/interfaces/goods'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
categoryId : '', // 一级分类
|
||||
categoryCid : '', // 二级分类
|
||||
name : '', // 标题
|
||||
pictures : [], // 轮播图
|
||||
content : [], // 详情图
|
||||
description : '', // 商品描述
|
||||
isPostSale : false, // 是否允许售后
|
||||
services : [], // 商品服务
|
||||
skus_cost : '0.00',// 市场价格
|
||||
skus_price : '0.00',// 销售价格
|
||||
skus_cost : '', // 市场价格
|
||||
skus_price : '', // 销售价格
|
||||
skus_number : 1, // 易货起购数量
|
||||
skus_unit : '件', // 规格文字
|
||||
skus_charge : '0.00',// 分销佣金
|
||||
skus_charge : '', // 分销佣金
|
||||
skus_stock : '', // 库存
|
||||
isChange : false, // 是否支持易货
|
||||
stores : [], // 关联店铺
|
||||
@@ -208,10 +210,49 @@
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if(this.$Route.query.type === 'edit'){
|
||||
console.log('编辑')
|
||||
// 编辑状态信息
|
||||
if(this.$Route.query.type && this.$Route.query.type === 'edit'){
|
||||
managesGoodsEdit(this.$Route.query.id).then(res => {
|
||||
console.log(res)
|
||||
let services = [], stores = []
|
||||
let servicesArr = res.services.map(val => {
|
||||
let check = (res.data.services.findIndex(obj => obj.service_id === val.service_id)) >= 0
|
||||
if(check){
|
||||
services.push(val.service_id)
|
||||
}
|
||||
return{
|
||||
check,
|
||||
...val
|
||||
}
|
||||
})
|
||||
let storesArr = res.stores.map(val => {
|
||||
let check = (res.data.stores.findIndex(obj => obj.store_id === val.store_id)) >= 0
|
||||
if(check){
|
||||
stores.push(val.store_id)
|
||||
}
|
||||
return {
|
||||
check,
|
||||
...val
|
||||
}
|
||||
})
|
||||
this.categoryId = res.data.category.category_id
|
||||
this.categoryCid = res.data.category_sub.category_id
|
||||
this.name = res.data.name
|
||||
this.content = res.data.content
|
||||
this.description = res.data.description
|
||||
this.pictures = res.data.pictures
|
||||
this.skus_cost = res.data.skus[0].cost
|
||||
this.skus_price = res.data.skus[0].price
|
||||
this.skus_number = res.data.skus[0].number
|
||||
this.skus_unit = res.data.skus[0].unit
|
||||
this.skus_charge = res.data.skus[0].charge
|
||||
this.skus_stock = res.data.skus[0].stock
|
||||
this.isPostSale = res.data.is_post_sale == 0
|
||||
this.isChange = res.data.is_change == 0
|
||||
this.logisticType= this.logisticArr.findIndex(val => val.type === res.data.logistic_type)
|
||||
this.servicesArr = servicesArr
|
||||
this.storesArr = storesArr
|
||||
this.services = services
|
||||
this.stores = stores
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
@@ -220,6 +261,7 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
// 添加配置信息
|
||||
managesCreate({
|
||||
category_cid: this.$Route.query.cid
|
||||
}).then(res => {
|
||||
@@ -239,6 +281,8 @@
|
||||
this.tags = res.tags
|
||||
this.servicesArr= res.services
|
||||
this.type = res.type
|
||||
this.categoryId = this.$Route.query.id
|
||||
this.categoryCid= this.$Route.query.cid
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
@@ -315,8 +359,8 @@
|
||||
let submitData = {
|
||||
name : this.name,
|
||||
cover : this.pictures[0].path,
|
||||
category_id : this.$Route.query.id,
|
||||
category_cid : this.$Route.query.cid,
|
||||
category_id : this.categoryId,
|
||||
category_cid : this.categoryCid,
|
||||
pictures : pictures,
|
||||
content : content,
|
||||
description : this.description,
|
||||
@@ -333,7 +377,8 @@
|
||||
stores : this.stores,
|
||||
expiried_at : this.expiriedAt
|
||||
}
|
||||
let submitFund = managesGoodsCreate(submitData)
|
||||
|
||||
let submitFund = this.$Route.query.type === 'edit' ? managesGoodsPut(this.$Route.query.id, submitData) : managesGoodsCreate(submitData)
|
||||
submitFund.then(res => {
|
||||
if(this.type === 2){
|
||||
uni.showModal({
|
||||
@@ -342,13 +387,27 @@
|
||||
showCancel : false,
|
||||
success : res => {
|
||||
if(res.confirm){
|
||||
this.$Router.back()
|
||||
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$Router.push({name: 'goodsAuth', params: { id: res , type: 'goodsAdd'}})
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?',
|
||||
cancelText : '稍后认证',
|
||||
confirmText : '立即认证',
|
||||
success : res => {
|
||||
if(res.cancel){
|
||||
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
|
||||
}
|
||||
if(res.confirm){
|
||||
let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res
|
||||
this.$Router.push({name: 'goodsAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}})
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { managesGoodsAuth } from '@/apis/interfaces/goods'
|
||||
import { managesGoodsAuth, managesGoodsExtends } from '@/apis/interfaces/goods'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
@@ -77,7 +77,21 @@
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
if(this.$Route.query.edit == 'true'){
|
||||
managesGoodsExtends(this.$Route.query.id).then(res => {
|
||||
this.productedAt = res.producted_at
|
||||
this.expiriedAt = res.expiried_at
|
||||
this.lisence = res.lisence
|
||||
this.productName = res.product_name
|
||||
this.productAddress = res.product_address
|
||||
this.extendCover = [{...res.cover}]
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// picker选择
|
||||
@@ -134,7 +148,11 @@
|
||||
showCancel : false,
|
||||
success : res => {
|
||||
if(res.confirm){
|
||||
this.$Router.back(this.$Route.query.type == 'goodsAdd' ? 2 : 1)
|
||||
if(this.$Route.query.type == 'goodsAdd'){
|
||||
this.$Router.back(this.$Route.query.edit == 'true' ? 2 : 3)
|
||||
}else{
|
||||
this.$Router.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
314
pages/market/details.vue
Normal file
314
pages/market/details.vue
Normal file
@@ -0,0 +1,314 @@
|
||||
<template>
|
||||
<view v-if="!loding">
|
||||
<!-- 产品信息 -->
|
||||
<view class="goods">
|
||||
<image class="cover" :src="info.goods.cover" mode="aspectFill"></image>
|
||||
<view class="content">
|
||||
<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>
|
||||
<view class="info">
|
||||
<view class="info-item">
|
||||
<label>转让用户</label>
|
||||
{{info.user.username}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>转让单价</label>
|
||||
¥{{info.price}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>出售数量</label>
|
||||
{{info.stock}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>剩余转让数量</label>
|
||||
{{info.surplus}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>区块HASH</label>
|
||||
{{info.hash}}
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<label>转让时间</label>
|
||||
{{info.created_at}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="buy-btn" type="default" @click="openLay">我要购买</button>
|
||||
<!-- 购买弹窗 -->
|
||||
<uni-popup ref="buyLay" :safe-area="true" background-color="#ffffff">
|
||||
<view class="popup">
|
||||
<view class="title">我要购买</view>
|
||||
<view class="des">
|
||||
剩余转让数量
|
||||
<text>{{info.surplus}}</text>
|
||||
</view>
|
||||
<view class="des">
|
||||
数量
|
||||
<uni-number-box v-model='stock' :min="1" :max="info.surplus" @change="countPrice"></uni-number-box>
|
||||
</view>
|
||||
<view class="des">
|
||||
订单总价
|
||||
<text class="price">¥{{price}}</text>
|
||||
</view>
|
||||
<view class="btn" @click="buy">提交订单</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<!-- 支付方式 -->
|
||||
<uni-popup ref="payLay" :safe-area="true" background-color="#ffffff">
|
||||
<view class="popup">
|
||||
<view class="title">支付方式</view>
|
||||
<radio-group class="pay-group" @change="payType">
|
||||
<view class="item">
|
||||
<label>
|
||||
<radio class="pay-radio" value="eb" checked color="#e93340" />
|
||||
<view class="pay-title">易货额支付</view>
|
||||
<view class="pay-sub-title">可用10,冻结10</view>
|
||||
</label>
|
||||
</view>
|
||||
<view class="item">
|
||||
<label>
|
||||
<radio class="pay-radio" value="wechat" color="#e93340" />
|
||||
<view class="pay-title">微信支付</view>
|
||||
</label>
|
||||
</view>
|
||||
</radio-group>
|
||||
<view class="btn" @click="orderPay">立即支付</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { marketsInfo, marketsBuy, marketsPay } from '@/apis/interfaces/market'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
payValue: 'eb',
|
||||
orderNo : '',
|
||||
price : '0.00',
|
||||
stock : 1,
|
||||
loding : true,
|
||||
info : {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
marketsInfo(5).then(res =>{
|
||||
this.info = res
|
||||
this.price = res.price
|
||||
this.loding = false
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
// 选择购买方式
|
||||
payType(e){
|
||||
this.payValue = e.detail.value
|
||||
},
|
||||
// 购买弹窗
|
||||
openLay(){
|
||||
this.$refs.buyLay.open('bottom')
|
||||
},
|
||||
// 计算价格
|
||||
countPrice(e){
|
||||
this.price = (e * this.info.price).toFixed(2)
|
||||
},
|
||||
// 提交购买单
|
||||
buy(){
|
||||
marketsBuy(5, {
|
||||
qty: this.stock
|
||||
}).then(res => {
|
||||
this.orderNo = res.market_order_no
|
||||
this.$refs.buyLay.close()
|
||||
this.$refs.payLay.open('bottom')
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 支付
|
||||
orderPay(){
|
||||
let data = {}
|
||||
if(this.payValue === 'wechat'){
|
||||
data = {
|
||||
type : 'app',
|
||||
openid : ''
|
||||
}
|
||||
}
|
||||
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'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 支付方式
|
||||
.pay-group{
|
||||
margin: 0 ($margin * 2);
|
||||
.item{
|
||||
position: relative;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
padding: $padding 0;
|
||||
&:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
.pay-radio{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
margin-top: -25rpx;
|
||||
}
|
||||
.pay-sub-title{
|
||||
font-size: $title-size-sm;
|
||||
color: $text-gray;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.pay-title{
|
||||
font-weight: bold;
|
||||
line-height: 50rpx;
|
||||
color: $text-color;
|
||||
font-size: $title-size-lg;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 我要购买按钮
|
||||
.buy-btn{
|
||||
margin: 0 $margin;
|
||||
background: $text-price;
|
||||
color: white;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
border-radius: $radius/2;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
// 产品信息
|
||||
.goods{
|
||||
min-height: 168rpx;
|
||||
position: relative;
|
||||
background: white;
|
||||
border-radius: $radius/2;
|
||||
margin: $margin;
|
||||
padding: $padding;
|
||||
.cover{
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
top: $padding;
|
||||
width: 168rpx;
|
||||
height: 168rpx;
|
||||
}
|
||||
.content{
|
||||
padding-left: calc(168rpx + #{$padding});
|
||||
.title{
|
||||
position: relative;
|
||||
font-size: $title-size-lg;
|
||||
color: $text-color;
|
||||
font-weight: bold;
|
||||
line-height: 52rpx;
|
||||
padding-right: 60rpx;
|
||||
text{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 60rpx;
|
||||
text-align: right;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
.text{
|
||||
font-size: $title-size-sm;
|
||||
color: $text-gray;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
&.nav-goods{
|
||||
color: $text-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
.info{
|
||||
margin-top: $margin;
|
||||
border-top: solid 1rpx $border-color;
|
||||
padding-top: $padding;
|
||||
.info-item{
|
||||
padding-left: 200rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 购买产品
|
||||
.popup {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
padding-bottom: $padding;
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
padding: 50rpx 30rpx 30rpx 30rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.btn {
|
||||
background-color: $text-price;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
margin: $padding * 2;
|
||||
border-radius: $radius/2;
|
||||
}
|
||||
.des {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
padding: $padding $padding * 2;
|
||||
color: $text-gray;
|
||||
font-size: $title-size-lg;
|
||||
text{
|
||||
color: $text-color;
|
||||
}
|
||||
.price{
|
||||
color: $main-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -6,40 +6,57 @@
|
||||
价格
|
||||
<image
|
||||
class="icon"
|
||||
mode="widthFix" :src="require(marketType == 'low' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
|
||||
mode="widthFix" :src="require(marketType == 'asc' ? '@/static/icons/market_icon_low.png': '@/static/icons/market_icon_high.png')"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lists">
|
||||
<view class="item" v-for="(item, index) in 10" :key="index">
|
||||
<image class="cover" src="@/static/dev/good_cover_00.jpg" mode="aspectFill"></image>
|
||||
<view class="item" v-for="(item, index) in marketArray" :key="index">
|
||||
<image class="cover" :src="item.goods.cover" mode="aspectFill"></image>
|
||||
<view class="content">
|
||||
<view class="title nowrap">易品新境权证<text>*1</text></view>
|
||||
<view class="text nowrap">谷风一木3层软抽面巾纸</view>
|
||||
<view class="text nowrap">转让方:温文尔雅的小阿玉</view>
|
||||
<view class="text nowrap">Hash:djsakljkljfl3213dsaHKLDJS82231csa</view>
|
||||
<view class="title nowrap">数字权证<text>{{item.surplus}}/{{item.stock}}</text></view>
|
||||
<view class="text nowrap">锚定商品:{{item.goods.goods_name}}</view>
|
||||
<view class="text nowrap">提供企业:{{item.company.name}}</view>
|
||||
<view class="text nowrap">转让用户:{{item.user.nickname}}</view>
|
||||
</view>
|
||||
<view class="price">¥21000.00/个</view>
|
||||
<view class="price">¥{{item.price}}/个</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { markets } from '@/apis/interfaces/market'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabIndex : 0,
|
||||
marketType : 'low',
|
||||
marketArray : []
|
||||
marketType : 'asc',
|
||||
marketArray : [],
|
||||
page : {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getMarkets()
|
||||
},
|
||||
methods:{
|
||||
// 筛选产品
|
||||
onTabs(e){
|
||||
let index = e.target.dataset.index
|
||||
if(index == 0 && index == this.tabIndex) return
|
||||
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'low' ? 'high': 'low'
|
||||
if(index == 1 && index == this.tabIndex) this.marketType = this.marketType == 'asc' ? 'desc': 'asc'
|
||||
this.tabIndex = index
|
||||
this.getMarkets()
|
||||
},
|
||||
// 获取转让市场
|
||||
getMarkets(){
|
||||
markets({
|
||||
sort: this.tabIndex == 1 ? this.marketType : ''
|
||||
}).then(res => {
|
||||
console.log(res.data)
|
||||
this.marketArray = res.data
|
||||
this.page = res.page
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(){
|
||||
|
||||
@@ -1,19 +1,81 @@
|
||||
<template>
|
||||
<view>
|
||||
成交历史
|
||||
<block v-if="logs.length > 0">
|
||||
<view class="logs" v-for="(item, index) in logs" :key="index">
|
||||
<view class="logs-item">
|
||||
<label>交易权证</label>
|
||||
{{item.goods.goods_name}}
|
||||
</view>
|
||||
<view class="logs-item">
|
||||
<label>交易单价</label>
|
||||
¥{{item.price}}
|
||||
</view>
|
||||
<view class="logs-item">
|
||||
<label>交易数量</label>
|
||||
{{item.qty}}
|
||||
</view>
|
||||
<view class="logs-item">
|
||||
<label>转让用户</label>
|
||||
{{item.sellUser.nickname}}
|
||||
</view>
|
||||
<view class="logs-item">
|
||||
<label>购买用户</label>
|
||||
{{item.buyUser.nickname}}
|
||||
</view>
|
||||
<view class="logs-item">
|
||||
<label>交易时间</label>
|
||||
{{item.created_at}}
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { marketsLogs } from '@/apis/interfaces/market'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
logs: [],
|
||||
page: {}
|
||||
};
|
||||
},
|
||||
created(){
|
||||
marketsLogs().then(res => {
|
||||
console.log(res.data)
|
||||
this.logs = res.data
|
||||
this.page = res.page
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.logs{
|
||||
background: white;
|
||||
margin-top: $margin;
|
||||
padding: ($padding - 10) $padding;
|
||||
.logs-item{
|
||||
padding-left: 200rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
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