商品管理页面修改

This commit is contained in:
zmj 2024-04-23 18:01:32 +08:00
parent 9802fda53a
commit 773efe87ca
7 changed files with 1935 additions and 195 deletions

View File

@ -12,7 +12,7 @@
</view>
<view class="card" style="min-height: 268rpx;">
<u-form-item label="商品图片" prop="userInfo.name" ref="item1" labelWidth='auto'>
<u-form-item label="商品图片" prop="formData.imageList" ref="item1" labelWidth='auto'>
<text style="font-size:24rpx ; color:#E18C34 ;">上传时应注重真实性清晰度</text>
</u-form-item>
<view class="" style="display: flex;flex-wrap: wrap;">
@ -68,14 +68,16 @@
</u-form-item>
<u-form-item label="零售价格" prop="userInfo.name" ref="item1" border-bottom>
<u--input inputAlign='right' placeholderStyle="color:#777777" style="width: 220rpx;"
placeholder="请输入零售价" v-model="formData.attrValue[0].price" slot='right'></u--input>
placeholder="请输入零售价" type='number' v-model="formData.attrValue[0].price"
slot='right'></u--input>
</u-form-item>
<u-form-item v-if='isWholeSale' label="批发价格" prop="userInfo.name" ref="item1" border-bottom>
<u--input inputAlign='right' placeholderStyle="color:#777777" style="width: 250rpx;"
placeholder="请输入批发价格" v-model="formData.attrValue[0].wholesale_price" slot='right'></u--input>
placeholder="请输入批发价格" type='number' v-model="formData.attrValue[0].wholesale_price"
slot='right'></u--input>
</u-form-item>
<u-form-item label="商品库存" prop="userInfo.name" ref="item1">
<u--input inputAlign='right' placeholderStyle="color:#777777" style="width: 220rpx;"
<u--input inputAlign='right' type='number' placeholderStyle="color:#777777" style="width: 220rpx;"
placeholder="请输入库存" v-model="formData.attrValue[0].stock" slot='right'></u--input>
</u-form-item>
</view>
@ -194,20 +196,29 @@
"imageList": [
],
attr: [{
detail: [],
value: ""
}, ],
"attrValue": [{
detail: {
规格名: 'attr[index]value',
},
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": '',
"cost": "",
"stock": "",
sku: '',
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"volume": "",
"extension_one": "",
"extension_two": "",
uuid: "",
volume: "",
"is_use": 0,
}],
"cate_name": "",
@ -218,10 +229,7 @@
],
"mer_cate_name": "",
"spec_type": "0",
attr: [{
detail: [],
value: ""
}, ],
"specifica": "",
"delivery_way": [
@ -263,12 +271,13 @@
maxLength: 30,
showSex: false,
rules: {
title: {
type: 'string',
required: true,
message: '请选择',
trigger: ['blur', 'change']
}
"formData.imageList": [{
validator: (rule, value, callback) => {
return this.formData.imageList.length >= 2
},
message: '请至少上传2张图片',
trigger: ['change', 'blur'],
}]
},
};
@ -418,7 +427,7 @@
});
},
async submit() {
handAdd() {
let data = uni.$u.deepClone(this.formData)
data.image = data.imageList[0]
data.slider_image = data.imageList.splice(0, 1)
@ -432,17 +441,25 @@
uni.$emit('importAttrValueOK', this.setFormData.import_id);
uni.navigateBack();
} else uni.redirectTo({
url: `/pages/product/goodsOnSale/index?mer_id=${this.mer_id}&type=6`
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
})
}).catch(() => {
uni.redirectTo({
url: `/pages/nongKe/gather/select_warehouse?mer_id=${this.mer_id}&stype=2`
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=2`
})
})
})
.catch(rej => {
// Toast(rej);
});
},
async submit() {
this.$refs.formData.validate().then(res => {
this.handAdd()
}).catch(errors => {
uni.$u.toast(errors[0].message)
})
}
},
onLoad(option) {

View File

@ -1,19 +1,21 @@
<template>
<view class='content'>
<u--form :model="model1" :rules="rules" ref="uForm" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
<u--form :model="formData" :rules="rules" ref="formData" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
labelWidth='auto'>
<view class="good-baseInfo card">
<u-form-item label="商品标题" prop="userInfo.name" ref="item1" required>
<u-form-item label="商品标题" prop="store_name" ref="item1" required>
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text>
</u-form-item>
<u-form-item label="" prop="userInfo.name" ref="item1">
<u--textarea v-model="formData.store_name" placeholder="建议描述产品品牌、名称、规格、口味"
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
:maxlength='maxLength'></u--textarea>
style="background-color: #F9F9F9;height: 166rpx;" :maxlength='maxLength'></u--textarea>
<!-- <u--textarea v-model="formData.store_name" placeholder="请输入内容"></u--textarea> -->
</u-form-item>
<u-form-item label="商品主图" prop="userInfo.name" ref="item1" required>
<u-form-item label="商品主图" prop="formData.imageList" ref="item1" required>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度</text>
<!-- {{formData.imageList}}
{{formData.content.image}} -->
</u-form-item>
<view class="card" style="min-height: 150rpx;margin-bottom: 0;padding: 0;">
<view class="" style="display: flex;flex-wrap: wrap;">
@ -43,11 +45,11 @@
<view class="jiao" @click="formData.imageList.splice(index,1)">
<image src="@/static/images/gban.png" mode="widthFix"></image>
</view>
<u--image :src="item" :fade="true" duration="450" width='140rpx'
height='140rpx'></u--image>
<u--image @click="preViewImg(item)" :src="item" :fade="true" duration="450"
width='140rpx' height='140rpx'></u--image>
</view>
</view>
<view class='uploadimg' @click="show=true">
<view class='uploadimg' @click="show=true,isDetail=false">
<u-icon name="plus" color="#777777"></u-icon>
<view class="" style="color: #777777;font-size: 20rpx;">
上传图片/视频
@ -57,7 +59,7 @@
</view>
<u-form-item label="商品详情" prop="userInfo.name" ref="item1" required>
<u-form-item label="商品详情" prop="formData.content.image" required>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度</text>
</u-form-item>
<view class="card" style="min-height: 150rpx;margin-bottom: 0;padding: 0;">
@ -66,7 +68,7 @@
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<view class="video_list" v-if='vidioTypeList.includes(getSuffix(item))'>
<view class="video_list_item photo" style="position: relative;">
<view class="jiao" @click="formData.imageList.splice(index,1)">
<view class="jiao" @click="formData.content.image.splice(index,1)">
<!-- video标签在app端层级过高 -->
<!--#ifndef APP-PLUS-->
<video :src="item"></video>
@ -85,11 +87,11 @@
</view>
</view>
<view class="" style="position: relative;" v-else>
<view class="jiao" @click="formData.imageList.splice(index,1)">
<view class="jiao" @click="formData.content.image.splice(index,1)">
<image src="@/static/images/gban.png" mode="widthFix"></image>
</view>
<u--image :src="item" :fade="true" duration="450" width='140rpx'
height='140rpx'></u--image>
<u--image @click="preViewImg(item)" :src="item" :fade="true" duration="450"
width='140rpx' height='140rpx'></u--image>
</view>
</view>
<view class='uploadimg' @click="show=true,isDetail=true">
@ -108,7 +110,7 @@
商品类目属性
</view>
<view class="card" style="padding: 14rpx 30rpx;">
<u-form-item label="商品分类" prop="userInfo.name" ref="item1" labelPosition="left" required>
<u-form-item label="商品分类" prop="cate_name" ref="item1" labelPosition="left" required>
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
@click="navgo(`/pages/product/addGoodDetail/goodsType?mer_id=${mer_id}&&formData=${JSON.stringify(formData)}`)">
<view style="margin-right: 10rpx;line-height: 25rpx;">{{ formData.cate_name|| '请选择'}}</view>
@ -129,7 +131,7 @@
规格与价格
</view>
<view class="card" style="min-height: 100rpx;padding: 14rpx 30rpx;">
<u-form-item label="规格与价格" prop="userInfo.name" ref="item1" labelPosition="left" required>
<u-form-item label="规格与价格" prop="formData.attrValue" ref="item1" labelPosition="left" required>
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
@click="navgo(`/pages/product/addGoodDetail/goodsPrice?formData=${JSON.stringify(formData)}&&mer_id=${mer_id}`)">
<view style="margin-right: 10rpx;line-height: 25rpx;">{{sets?"已设置":""}}
@ -141,19 +143,29 @@
<view class="" v-if="showSet">
<view class="" v-for="(item,index) in formData.attrValue.filter(item=> item.is_use==0)">
<view class="" v-if='formData.attrValue.filter(item=> item.is_use==0).length==1'>
<u-line color="#CECECE" style="margin-bottom: 30rpx;"></u-line>
<u-line color="#CECECE" style="margin: 30rpx 0;"></u-line>
<view class="" style="display: flex;justify-content: space-around;">
<view class=""
style="display: flex;justify-content: space-around;flex: 1;border-right: 1px solid #CECECE;">
<text>零售价格</text>
<text>5000/</text>
<text>{{item.price}}/{{item.unit_name}}</text>
</view>
<view class="" style="display: flex;justify-content: space-around;flex: 1;">
<text>商品库存</text>
<text>5000</text>
<text>{{item.stock}}</text>
</view>
</view>
<u-line color="#CECECE" style="margin: 30rpx 0;" v-if='isWholeSale'></u-line>
<view class="" style="display: flex;justify-content: space-around;" v-if='isWholeSale'>
<view class=""
style="display: flex;justify-content: space-around;flex: 1;border-right: 1px solid #CECECE;">
<text>批发价格</text>
<text>{{item.wholesale_price}}/{{item.wholesale_unit_name}}</text>
</view>
<view class="" style="display: flex;justify-content: space-around;flex: 1;">
<text>批发单位</text>
<text>{{item.stock}}</text>
</view>
</view>
</view>
<view class="" v-else>
@ -193,15 +205,14 @@
</view>
<view class="card" style="padding: 14rpx 30rpx;">
<u-form-item label="商品详细描述" prop="userInfo.name" ref="item1" labelPosition="left">
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text>
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{300}}</text>
</u-form-item>
<u--textarea v-model="formData.store_info" placeholder="货品描述请严格遵循《广告法》规定,避免出现虚假宣传和误导消费者的词语"
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
:maxlength='maxLength'></u--textarea>
style="background-color: #F9F9F9;height: 166rpx;" :maxlength='300'></u--textarea>
<u-line color="#F3F3F3" style="margin: 30rpx 0;"></u-line>
<u-form-item label="送货方式" labelPosition="left" required>
<u-checkbox-group v-model="delivery_way" placement="row" slot="right">
<u-form-item label="送货方式" labelPosition="left" prop='delivery_way' required>
<u-checkbox-group v-model="formData.delivery_way" placement="row" slot="right">
<u-checkbox shape="circle" v-for="(item, index) in checkboxList1" :key="index"
:label="item.name" :name="item.value" activeColor="#20B128"
:customStyle="{marginRight: '8px'}"
@ -311,36 +322,45 @@
"imageList": [
],
"attrValue": [{
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": "",
"cost": "",
"stock": "",
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"volume": "",
"extension_one": "",
"extension_two": "",
"is_use": 0,
"spec_type": ""
}],
"cate_name": "",
"unit_name": "",
"cate_id": "",
"mer_cate_id": [],
"mer_cate_name": "",
"spec_type": "0",
attr: [{
detail: [],
value: ""
}, ],
"attrValue": [{
detail: {
规格名: 'attr[index]value',
},
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": '',
"cost": "",
"stock": "",
sku: 'attr[index]value',
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"extension_one": "",
"extension_two": "",
uuid: "",
volume: "",
"is_use": 0,
}],
"cate_name": "",
"unit_name": "",
"cate_id": '',
"mer_cate_id": [
],
"mer_cate_name": "",
"spec_type": "",
"specifica": "",
"delivery_way": [],
"delivery_free": "",
"delivery_way": [
],
"delivery_free": "1",
"temp_id": "",
"tempName": "",
"once_min_count": "",
@ -408,7 +428,71 @@
},
],
attrRules: {
price: '单价不能为空',
unit_name: '计量单位不能为空',
wholesale_price: '批发价格不能为空',
wholesale_unit_name: '批发单位不能为空',
stock: '库存不能为空'
},
rules: {
"formData.imageList": [{
validator: (rule, value, callback) => {
return this.formData.imageList.length >= 2
},
message: '请至少上传2张图片',
trigger: ['change', 'blur'],
}],
"formData.attrValue": [{
validator: (rule, value, callback) => {
if (!this.isWholeSale) {
delete this.attrRules.wholesale_unit_name
delete this.attrRules.wholesale_price
}
let errList = []
this.formData.attrValue.forEach(item => {
for (let key in this.attrRules) {
if (!item[key]) {
errList.push(this.rules[key])
}
}
})
console.log(errList, 'err')
return errList.length == 0
},
message: '请填写完整商品规格',
trigger: ['change', 'blur'],
}],
'store_name': {
type: 'string',
required: true,
message: '请填写商品标题',
trigger: ['blur', 'change']
},
'cate_name': {
type: 'string',
required: true,
message: '请填写商品分类',
trigger: ['blur', 'change']
},
'delivery_way': {
validator: (rule, value, callback) => {
return this.formData.delivery_way.length > 0
},
required: true,
message: '请选择送货方式',
trigger: ['blur', 'change']
},
'formData.content.image': {
validator: (rule, value, callback) => {
return this.formData.content.image.length > 0
},
required: true,
message: '请上传商品详情图',
trigger: ['blur', 'change']
},
},
radio: '',
@ -416,6 +500,14 @@
};
},
methods: {
preViewImg(url) {
let that = this
uni.previewImage({
urls: [url],
});
},
deleteImage(index) {
// this.addGoodsSecoundData.video_link = '';
},
@ -457,7 +549,18 @@
count: 6,
url: 'upload/image'
}, function(res) {
that.formData.imageList.push(res.data.path);
if (that.isDetail) {
that.formData.content.image.push(res.data.path.replace(
/\\/g, ""));
} else {
that.$set(that.formData.imageList, that.formData.imageList.length, res.data.path.replace(
/\\/g,
""));
}
// that.formData.imageList.push(res.data.path);
});
},
//
@ -559,7 +662,7 @@
getAttrValue(object) {
this.formData.attrValue = object
},
async submit() {
async handAdd() {
let that = this
let data = uni.$u.deepClone(this.formData)
data.image = data.imageList[0]
@ -588,9 +691,11 @@
Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
if (this.import == 1) {
uni.$emit('importAttrValueOK', this.setFormData.import_id);
uni.navigateBack();
uni.redirectTo({
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
})
} else uni.redirectTo({
url: `/pages/product/goodsOnSale/index?mer_id=${that.mer_id}&type=6`
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
})
}).catch(() => {
uni.navigateBack()
@ -600,8 +705,15 @@
// Toast(rej);
})
},
submit() {
this.$refs.formData.validate().then(res => {
this.handAdd()
}).catch(errors => {
uni.$u.toast(errors[0].message)
})
},
initFormData(option) {
this.delivery_way = this.$store.state.app.userInfo?.mer_info.delivery_way.split(',')
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
this.mer_id = option.mer_id
if (option.formData) {
@ -616,21 +728,25 @@
this.showSet = option.showSet ? JSON.parse(option.showSet) : this.showSet
let that = this
this.isSet2()
if (option.product_id) {
that.formData.product_id = option.product_id
this.mode = 'edit'
this.showSet = true
productDetail(option.mer_id, option.product_id).then(res => {
this.formData = res.data
//
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
this.formData.cate_name = this.formData.storeCategory.cate_name
this.formData.cate_id = this.formData.storeCategory.store_category_id
this.formData.imageList = this.formData.image_list
})
}
console.log(this.formData)
// console.log(this.isSet(this.formData.attrValue))
that.formData.delivery_way = that.$store.state.app.userInfo?.mer_info.delivery_way.split(',')
console.log(that.formData)
// if (option.product_id) {
// that.formData.product_id = option.product_id
// this.mode = 'edit'
// this.showSet = true
// productDetail(option.mer_id, option.product_id).then(res => {
// this.formData = res.data
// //
// this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
// this.formData.cate_name = this.formData.storeCategory.cate_name
// this.formData.cate_id = this.formData.storeCategory.store_category_id
// this.formData.imageList = this.formData.image_list
// if (!that.formData.imageList) that.formData.imageList = []
// })
// }
},
onBackPress: function(e) {
this.showlay = true

View File

@ -1,9 +1,7 @@
<template>
<view class="content">
<view class="">
<u-button icon="plus" text="新增规格"
@click="formData.attrValue.push({is_use:true}),formData.attr.push({value:'',detail: [],})"
class="custom-style" iconColor='#38BE41'></u-button>
<u-button icon="plus" text="新增规格" @click="pushFn" class="custom-style" iconColor='#38BE41'></u-button>
</view>
<view class="card" v-for="(item,index) in attrValue">
<view class="card-head card-li">
@ -16,8 +14,8 @@
<view class="">
<view class="" style="display: flex;align-items: center;justify-content: space-between;">
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输入商品单价"
v-model="item.price"></u--input>
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输入商品单价" v-model="item.price"
type='number'></u--input>
<view class="" style="flex: 1;text-align: center;">
/
</view>
@ -27,7 +25,7 @@
<view class="" v-if='isWholeSale'
style="display: flex;align-items: center;justify-content: space-between;margin-top: 30rpx;">
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输批发价格"
v-model="item.wholesale_price"></u--input>
v-model="item.wholesale_price" type='number'></u--input>
<view class="" style="flex: 1;text-align: center;">
/
</view>
@ -81,33 +79,107 @@
value: "",
formData: {},
"attrValue": [{
detail: {
规格名: 'attr[index]value',
},
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": "",
"wholesale_price": '',
"cost": "",
"stock": "",
sku: 'attr[index]value',
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"volume": "",
"extension_one": "",
"extension_two": "",
uuid: "",
volume: "",
"is_use": 0,
"spec_type": ""
}],
rules: {
price: '单价不能为空',
unit_name: '计量单位不能为空',
wholesale_price: '批发价格不能为空',
wholesale_unit_name: '批发单位不能为空',
stock: '库存不能为空'
}
}
},
methods: {
pushFn() {
this.attrValue.push({
detail: {
规格名: 'attr[index]value',
},
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": '',
"cost": "",
"stock": "",
sku: 'attr[index]value',
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"extension_one": "",
"extension_two": "",
uuid: "",
volume: "",
"is_use": true,
})
this.formData.attr.push({
value: '',
detail: [],
})
},
submit() {
let errList = []
if (!this.isWholeSale) {
delete this.rules.wholesale_unit_name
delete this.rules.wholesale_price
}
this.attrValue.forEach(item => {
for (let key in this.rules) {
if (!item[key]) {
errList.push(this.rules[key])
}
}
})
if (errList.length > 0) {
uni.$u.toast(errList[0])
return
}
let flag = false
if (this.formData.attr.length > 1) {
this.formData.attr.forEach(item => {
if (!item.value) {
flag = true
}
})
}
if (flag) {
uni.$u.toast('请填写规格名称')
return
}
this.formData.attrValue = this.attrValue
this.formData.attrValue.forEach(item => {
item.is_use = item.is_use ? '0' : '1'
})
let that = this
this.formData.attrValue.forEach((item, index) => {
item.detail.规格名 = this.formData.attr[index].value
item.sku = this.formData.attr[index].value
})
this.formData.spec_type = this.formData.attrValue.length > 1 ? '1' : '0'
uni.reLaunch({
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${that.mer_id}&&formData=${JSON.stringify(that.formData) }&&showSet=${true}`
})
@ -134,8 +206,6 @@
detail: [],
})
}
console.log(this.formData)
console.log(this.attrValue)
}
}

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,8 @@
</div>
</view> -->
<view class="longTab" style="padding-bottom: 20rpx;">
<!-- <view class="longTab">
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;" scroll-with-animation
class="menu" :scroll-left="tabLeft" show-scrollbar="true">
<view class="longItem" :style="'width:' + isWidth + 'px'" :data-index="index"
@ -54,49 +55,83 @@
<view class="underline bg-color-white"></view>
</view>
</scroll-view>
</view>
</view> -->
<u-tabs :list="tabList" @click="selectMenu" type='primary' lineColor='#32BB3B'></u-tabs>
<view class="wrapper" style="background-color: #F1F1F1;">
<view class='product_list' v-if="productList && productList.length > 0">
<view v-for="(item,index) in productList" :key="index" class="card">
<view v-for="(item,index) in productList" :key="index" class="card"
:style="{height:where.type==1?'410rpx':'336rpx'}">
<view class="card-top">
<view class="" style="width: 196rpx;height: 196rpx;position: relative;margin-right: 20rpx;">
<u--image :src="item.image" width='196rpx' height='196rpx' duration="450"></u--image>
<view class="preview" @click="preViewImg(item.image)">
<view class="preview" @click="preViewImg(item)">
点击预览
</view>
</view>
<view class="card-head-right">
<view class="" style="font-size: 32rpx;">
<view class="ellipsis">
{{item.store_name}}
</view>
<view class="" style="margin-top: 10rpx;font-size: 24rpx;color: #989898;">
库存 96
库存 {{item.attrValue[0].stock}}
</view>
</view>
<view class="" style="color: #FC452F;font-size: 24rpx;">
<text style="font-size: 22rpx;"></text><text>10.00</text><text
style="color: #828282;">/</text>
<text style="color:#989898" v-if='isWholeSale'>零售</text> <text
style="font-size: 22rpx;"></text><text>{{item.attrValue[0].price}}</text><text
style="color: #828282;">/{{item.attrValue[0].unit_name}}</text>
</view>
<view class="" style="color: #FC452F;font-size: 24rpx;" v-if='isWholeSale'>
<text style="color:#989898">批发</text> <text
style="font-size: 22rpx;"></text><text>{{item.attrValue[0].wholesale_price}}</text><text
style="color: #828282;">/{{item.attrValue[0].wholesale_unit_name}}</text>
</view>
</view>
</view>
<view class="" style="padding: 20rpx;">
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
<view class="" style="padding:10rpx 20rpx 20rpx; 20rpx">
<u-line color="#CECECE" style="margin: 0rpx 0 0px 0"></u-line>
</view>
<view class=""
style="display: flex;justify-content: space-between;font-size: 28rpx;font-size: 28rpx;">
<view class="" style="border-right: 1px solid #CECECE;flex: 1;text-align: center;">
<view class="" style="border-right: 1px solid #CECECE;flex: 1;text-align: center;"
@click="showOverly=true,xjItem=item" v-if='where.type==6||where.type==5'>
删除
</view>
<view class="" v-else style="border-right: 1px solid #CECECE;flex: 1;text-align: center;"
@click="Fline(item)">
修改库存
</view>
<view class="" style="border-right: 1px solid #CECECE;flex: 1;text-align: center;">
<view class="" v-if=' xjList.includes(where.type) '
style="border-right: 1px solid #CECECE;flex: 1;text-align: center;"
@click="showOverly=true,xjItem=item">
下架
</view>
<view class="" style="flex: 1;text-align: center;">
<view class="" v-if='sjList.includes(where.type)'
style="border-right: 1px solid #CECECE;flex: 1;text-align: center;"
@click="handleShelves(item,1)">
上架
</view>
<view class="" style="flex: 1;text-align: center;" @click="editGoods(item)">
编辑商品
</view>
</view>
<view class="card-footer">
<view class="card-footer" v-if='where.type==1'>
<view class="card-footer-li" style="flex: 1.5;">
近30天 访客<text style="color: #FC452F;">{{item.product_visitor_number}}</text>
</view>
<view class="card-footer-li" style="flex: 1;">
咨询<text style="color: #FC452F;">{{item.product_consult_number}}</text>
</view>
<view class="card-footer-li" style="flex: 1;border: none;">
订单<text style="color: #FC452F;">{{item.product_order_number}}</text>
</view>
</view>
<!-- <view class='item' @click="yinc">
@ -168,8 +203,46 @@
<view class="footer-li act">
发布商品
</view>
</view>
<u-overlay :show="showOverly||(where.type==2&&flag)||(where.type==3&&flag1)">
<view class="warp">
<view class="" style='font-size: 32rpx;'>
温馨提示
</view>
<view class="" v-if='where.type==6'>
当前商品待审核删除后将移至回收站
</view>
<view class="" v-else-if='where.type==5'>
确定删除吗
</view>
<view class="" v-else-if='where.type==2'>
仓库页面商品点击上架即可开售
</view>
<view class="" v-else-if='where.type==3&&flag1'>
页面商品已经售罄如有存货可添加库存数量若没有库存可进行下架操作
</view>
<view class="warp-tit" v-else>
当前商品正在销售中,下架后将移至仓库
</view>
<view class="warp-foot">
<view class="warp-foot-li" v-if='![2,3].includes(where.type)'>
<u-button text="返回" @click="showOverly = false"></u-button>
</view>
<!-- <view class="warp-foot-li" v-if='where.type==2&&'>
<u-button text="返回" @click="showOverly = false"></u-button>
</view> -->
<view class="warp-foot-li">
<u-button type='primary' v-if='where.type==6||where.type==5' text="删除"
@tap="handleRecycle(xjItem)"></u-button>
<u-button type='primary' v-else-if='(where.type==2 && flag) ||(where.type==3 &&flag1)'
text="我知道了" @tap="Iknow"></u-button>
<u-button type='primary' v-else text="继续下架" @tap="handleShelves(xjItem,0)"></u-button>
</view>
</view>
</view>
</u-overlay>
<u-popup :show="show" @close="close" mode="center" bgColor='transparent'>
<image src="@/static/images/xianxia.png" mode="widthFix"></image>
<view class="popen">
@ -232,7 +305,8 @@
productOffApi,
productRecommendApi,
productUpdateFree,
productTitle
productTitle,
productDestory
} from "@/api/product";
import {
labelLst
@ -265,6 +339,13 @@
},
data() {
return {
flag1: true,
flag: true,
xjList: [1, 3, 4],
sjList: [2],
xjItem: "",
showOverly: false,
isWholeSale: false,
status: 'loadmore',
current: "",
where: {
@ -322,20 +403,24 @@
onLoad(options) {
this.getUserInfo()
this.getCategoryList();
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
if (options.type) {
this.tabClick = options.type
}
var that = this;
//
uni.getSystemInfo({
success(e) {
that.isWidth = e.windowWidth / 5;
console.log(that.isWidth)
}
});
},
onPullDownRefresh() {
this.where.page = 1
this.productList = []
this.loading = false
this.loaded = false
this.productList = []
this.getList(this.mer_id, false);
uni.stopPullDownRefresh()
},
@ -347,20 +432,37 @@
},
methods: {
preViewImg(url) {
let that = this
uni.previewImage({
urls: [url],
// longPressActions: {
// itemList: ['', '', ''],
// success: function(data) {
// console.log('' + (data.tapIndex + 1) + ',' + (data.index + 1) + '');
// },
// fail: function(err) {
// console.log(err.errMsg);
// }
// }
});
Iknow() {
if (this.where.type == 2) {
this.flag = false
} else {
this.flag1 = false
}
this.showOverly = false
},
showInWarehouse() {
if (flag) {
this.showOverly = true
}
},
preViewImg(item) {
uni.navigateTo({
url: `/pages/admin/goods_details/index?product_id=${item.product_id}&product_type=0`
})
// let that = this
// uni.previewImage({
// urls: [url],
// // longPressActions: {
// // itemList: ['', '', ''],
// // success: function(data) {
// // console.log('' + (data.tapIndex + 1) + ',' + (data.index + 1) + '');
// // },
// // fail: function(err) {
// // console.log(err.errMsg);
// // }
// // }
// });
},
//
@ -388,8 +490,10 @@
},
//
selectMenu(item, index) {
selectMenu(item) {
let index = this.tabList.findIndex(items => items.name == item.name);
this.where.type = item.type;
console.log(this.where.type)
this.loading = this.loaded = false;
this.where.page = 1;
this.shopList = [];
@ -744,46 +848,56 @@
},
handleRecycle(item, index) {
let that = this;
Modal('温馨提示', `商品"${item.store_name}"将被加入回收站,请问是否继续?`).then(res => {
productDeleteApi(that.mer_id, item.product_id)
productDestory(that.mer_id, item.product_id)
.then(res => {
that.$util.Tips({
title: res.message,
icon: 'success'
}, () => {
that.productList.splice(index, 1);
// that.productList.splice(index, 1);
});
this.$set(this, 'num', -1);
// this.$set(this, 'num', -1);
})
.catch(rej => {
this.$set(this, 'num', -1);
Toast(`${rej}, 加入回收站失败`);
});
Toast(`${rej}, 删除失败`);
});
this.showOverly = false
},
// 0
handleShelves(item, status) {
let that = this;
if (status == 0) {
uni.showModal({
content: '确定要下架该商品么?',
success: function(res) {
if (res.confirm) {
that.onAndOff(item, 0)
uni.showToast({
title: '下架成功',
icon: 'none'
})
that.getList(this.mer_id, false)
} else if (res.cancel) {
// console.log('');
}
}
});
that.showOverly = false
this.productList = []
this.getList(this.mer_id, false);
// uni.showModal({
// content: '',
// success: function(res) {
// if (res.confirm) {
// that.onAndOff(item, 0)
// uni.showToast({
// title: '',
// icon: 'none'
// })
// that.getList(this.mer_id, false)
// } else if (res.cancel) {
// // console.log('');
// }
// }
// });
} else {
that.onAndOff(item, 1)
this.productList = []
this.getList(this.mer_id, false);
}
},
//
@ -907,14 +1021,81 @@
background-color: #FFF1EC;
position: absolute;
bottom: 0;
display: flex;
// justify-content: space-around;
align-items: center;
font-size: 24rpx;
color: #777777;
.card-footer-li {
text-align: center;
border-right: 1rpx solid #BDA9A1;
}
}
}
.warp {
background-color: white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 590rpx;
height: 354rpx;
border-radius: 16rpx;
padding: 50rpx 44rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
.warp-tit {
font-size: 28rpx;
color: #777777;
// widows: 490rpx
}
.warp-foot {
display: flex;
// background-color: red;
width: 490rpx;
justify-content: space-around;
.warp-foot-li {
width: 236rpx;
height: 84rpx;
border-radius: 12rpx;
}
}
}
.ellipsis {
width: 400rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.longTab {
display: flex;
width: 100%;
.longItem {
width: 200px !important;
height: 50upx;
display: inline-block;
line-height: 50upx;

View File

@ -23,9 +23,9 @@
</view>
</view>
</view>
<view class="attr">
<view class="attr" v-for="(item,index) in short.attrValue" :key="index">
<view class="attr-tit">
这是大苏打
{{item.sku}}
</view>
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;">
@ -34,26 +34,12 @@
</view>
<view class="" style="display: flex;align-items: center;color: #FC452F;">
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
v-model="test"></u--input>
v-model="item.stock"></u--input>
</view>
</view>
</view>
<view class="attr">
<view class="attr-tit">
这是大苏打
</view>
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;">
<view class="">
商品库存
</view>
<view class="" style="display: flex;align-items: center;color: #FC452F;">
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
v-model="test"></u--input>
</view>
</view>
</view>
<view class="table">
<!-- <view class="table">
<u-sticky custom-nav-height="0" bgColor="#fff">
<view class="line th">
<view class="td img">图片</view>
@ -75,7 +61,7 @@
<input type="number" v-model="item.stock" />
</view>
</view>
</view>
</view> -->
<view style="height: 150rpx;"></view>
<!-- <view class="btn-view">
<button class="btn" @click="show=true">确认修改</button>
@ -106,6 +92,7 @@
show: false,
defualtImg: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
mer_id: '',
type: "",
short: {
product_id: ''
}
@ -158,18 +145,21 @@
this.$nextTick(() => {
Toast('更新成功');
})
uni.navigateBack({
success: () => {
let stock = 0;
this.short.attrValue.forEach(item => {
stock = stock + parseInt(item.stock);
})
uni.$emit('updateStock', {
product_id: this.short.product_id,
stock: stock
})
}
uni.redirectTo({
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
})
// uni.navigateBack({
// success: () => {
// let stock = 0;
// this.short.attrValue.forEach(item => {
// stock = stock + parseInt(item.stock);
// })
// uni.$emit('updateStock', {
// product_id: this.short.product_id,
// stock: stock
// })
// }
// })
}).catch(err => {
this.show = false;
this.$util.Tips({

View File

@ -686,7 +686,6 @@ export default {
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
...obj,
success: function(res) {
console.log(res.tempFilePaths);
//启动上传等待中...
uni.showLoading({
title: '图片上传中',