H5-ThreeDoorder/components/bGoods/bGoods.vue

186 lines
4.9 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="flex flex-space-between" style="margin-bottom: 30rpx;">
<view class="flex">
<view class="" style="margin-right: 20rpx;">
<u-image width="180rpx" height="180rpx" radius="10rpx" :src="detail.goodsImg"></u-image>
</view>
<view class="" style="align-items: bottom;">
<view class="" :style="'height:' +(types == 0?'100':'80')+'rpx;'">
<u-text color="#333333" size="28rpx" lines="2" :text="detail.goodsTitle"></u-text>
</view>
<view class="fy">
<view class="je-class">
<text style="font-size: 20rpx;"></text><text>{{detail.price/100}}</text>
</view>
<view class="">
<text>分佣比</text><text style="color:#E71111">{{detail.commission_point}}</text><text>%</text>
</view>
<view class="lit-999">
<text>销量{{detail.sales}}</text>
</view>
<view class="lit-999" v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1">
<text>库存:{{detail['stock']}}</text>
</view>
<view class="lit-999" v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1">
<text>阿里销量:{{detail['ali_sales']}}</text>
</view>
</view>
</view>
</view>
<view class="flex" style="align-items: center;margin-left: 20rpx;">
<view class="" v-if="types == 0">
<view class="check-btn" @click="checkThis2">
选择
</view>
</view>
<view class="" v-if="types == 1">
<!-- 添加阿里库存 -->
<view v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1" class="Add-stock" @click="show = true">
增加库存
</view>
<block v-if="detail.status == 2">
</block>
<block v-if="detail.status == 4">
<view class="check-btn" @click="checkThis(0)">
上架
</view>
</block>
<block v-if="detail.status == 3">
<view class="check-btn check-btn-red" @click="checkThis(1)">
编辑
</view>
<u-gap height="20rpx"></u-gap>
<view class="check-btn" @click="checkThis(2)">
重新提交审核
</view>
</block>
<block v-if="detail.status == 1">
<view class="check-btn" @click="checkThis(3)">
下架
</view>
</block>
<block v-if="detail.status == 0">
<view class="check-btn check-btn-red" @click="checkThis(1)">
编辑
</view>
<u-gap height="20rpx"></u-gap>
<view class="check-btn" @click="checkThis(0)">
重新上架
</view>
</block>
</view>
</view>
</view>
<!-- 添加库存弹框 -->
<u-modal :show="show" title="添加库存" showCancelButton @confirm="confirm" @close="show = false" @cancel="show = false">
<view class="slot-content">
<u-input placeholder="请输入内容" border="surround" v-model="value"></u-input>
</view>
</u-modal>
</view>
</template>
<script>
export default {
name: "bGoods",
props: {
types: {
type: Number,
default: 0
},
detail: {
type: Object,
default: null
}
},
data() {
return {
show: false,
value:'',
};
},
methods: {
checkThis(type) {
// 0上架 1编辑 2提交审核 3下架
let title = type == 0?'上架成功':type == 3?'下架成功':'';
this.$emit('checkThis', {
type: type,
goods_id: this.detail.goods_id
},()=>{
console.log('提示');
uni.showToast({
title,
})
})
},
checkThis2() {
// 0上架 1编辑 2提交审核 3下架
this.$emit('checkThis', this.detail)
},
// 增加库存点击确认按钮
confirm(){
uni.showLoading({
title: '加载中...'
});
this.$store.dispatch('shop/itemInventoryModify',{
g_id:this['detail']['goods_id'],
stock:+this['value']
}).then(res => {
uni.showToast({
title:'设置成功'
});
this['show'] = false;
this['value'] = '';
uni.hideLoading();
})
}
// 上下架的那个接口不变
// 增加库存 /store.goods/itemInventoryModify 传g_id:商品id;stock:增加的库存
// 高德订单列表 /store.order/gdOrderList 传date:日期(时间格式);item_title:商品名称;commission_type:结算类型(0:未;1:已)
// 高德订单详情 /store.order/gdOrderInfo 传 order_no
}
}
</script>
<style>
.je-class {
font-size: 30rpx;
color: #E71111;
}
.fy {
font-size: 24rpx;
color: #666666;
}
.check-btn {
width: 170rpx;
background: linear-gradient(45deg, #FFAD02, #FD8F3B);
text-align: center;
color: #fff;
font-size: 24rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 20rpx;
}
.check-btn-red {
background: #E71111;
}
.Add-stock {
height: 60rpx;
background: #DE0D0D;
color: #ffff;
font-size: 24rpx;
text-align: center;
line-height: 60rpx;
border-radius: 20rpx;
margin-bottom: 15rpx;
}
</style>