商品添加优化

This commit is contained in:
THK3121 2023-06-06 18:06:22 +08:00
parent 9d9762bd80
commit 0d2438ccff
9 changed files with 865 additions and 810 deletions

View File

@ -26,7 +26,8 @@
</view> </view>
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<view>发票抬头</view> <view>发票抬头</view>
<input name="receipt_title" :value="receipt_title" :maxlength="20" placeholder="需要开具发票的企业名称"/> <input v-if="receipt_title_type == 1" name="receipt_title" :value="receipt_title" :maxlength="20" placeholder="需要开具发票的姓名"/>
<input v-else name="receipt_title" :value="receipt_title" :maxlength="20" placeholder="需要开具发票的企业名称"/>
<text class="iconfont icon-xiangyou" @click="callTitle" ></text> <text class="iconfont icon-xiangyou" @click="callTitle" ></text>
</view> </view>
<view v-show="receipt_title_type == '2'" class="acea-row row-middle"> <view v-show="receipt_title_type == '2'" class="acea-row row-middle">

View File

@ -103,7 +103,7 @@
</view> </view>
</view> </view>
<!-- <gatherBusiness :userInfoData="userInfoData" /> --> <gatherBusiness :userInfoData="userInfoData" />
</view> </view>
<!-- <view class="business com" v-if="userInfoData.mer_info.type_id === 11"> --> <!-- <view class="business com" v-if="userInfoData.mer_info.type_id === 11"> -->
@ -230,7 +230,7 @@
that.userInfoData = res.data; that.userInfoData = res.data;
this.mer_id = res.data.service.mer_id this.mer_id = res.data.service.mer_id
if (!res.data.mer_info) { if (!res.data.mer_info) {
that.$set(this, 'jurisdiction', true); that.$set(this, 'jurisdiction', false);
} }
}); });
} }

View File

@ -894,6 +894,7 @@
//, //,
if (productSelect === undefined && !this.attr.productAttr.length) if (productSelect === undefined && !this.attr.productAttr.length)
productSelect = this.attr.productSelect; productSelect = this.attr.productSelect;
console.log(productSelect);
//0 //0
if (productSelect === undefined) return; if (productSelect === undefined) return;
let stock = productSelect.stock || 0; let stock = productSelect.stock || 0;
@ -904,11 +905,11 @@
this.$set(this.attr.productSelect, "cart_num", stock); this.$set(this.attr.productSelect, "cart_num", stock);
this.$set(this, "cart_num", stock); this.$set(this, "cart_num", stock);
} }
if (num.cart_num > this.storeInfo.once_max_count && this.storeInfo.once_max_count != 0) { if (num.cart_num > productSelect.stock) {
this.$set(this.attr.productSelect, "cart_num", this.storeInfo.once_max_count); this.$set(this.attr.productSelect, "cart_num", this.storeInfo.once_max_count);
this.$set(this, "cart_num", this.storeInfo.once_max_count); this.$set(this, "cart_num", this.storeInfo.once_max_count);
return this.$util.Tips({ return this.$util.Tips({
title: "单次购买件数不能超过" + this.storeInfo.once_max_count + "件!" title: "单次购买件数不能超过" + productSelect.stock + "件!"
}); });
} }
} else { } else {

View File

@ -47,12 +47,12 @@
}; };
}, },
onLoad() { onLoad() {
}, },
methods: { methods: {
addor(item, index) { addor(item, index) {
this.info.num += item; this.info.num += item;
if (this.info.num <= 0) { if (this.info.num <= 0) {
console.log(goods_info);
this.info.num = 1; this.info.num = 1;
} }
}, },

View File

@ -183,7 +183,7 @@
if (type === 1) { if (type === 1) {
if (this.stype == 1) { if (this.stype == 1) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/product/addGoods/index' url: `/pages/product/addGoods/index?mer_id=${this.mer_id}`
}); });
return; return;
} }

View File

@ -9,8 +9,8 @@
placeholder-class="inputPlaceHolder" /> placeholder-class="inputPlaceHolder" />
</view> </view>
<view class="input_content_textarea"> <view class="input_content_textarea">
<textarea v-model="setFormData.store_name" placeholder="请输入商品名称" placeholder-class="placeholderStyle" <textarea v-model="setFormData.store_name" placeholder="请输入商品名称"
maxlength="60" /> placeholder-class="placeholderStyle" maxlength="60" />
<view> <view>
<text v-if="setFormData.store_name">{{ setFormData.store_name.length }}</text> <text v-if="setFormData.store_name">{{ setFormData.store_name.length }}</text>
<text v-else>0</text> <text v-else>0</text>
@ -20,13 +20,15 @@
<view class="photo_count"> <view class="photo_count">
<text class="photo_size">建议图片尺寸为750*750px</text> <text class="photo_size">建议图片尺寸为750*750px</text>
<view class="input_content_photo"> <view class="input_content_photo">
<view class="input_content_photo_adPh" v-for="(item, index) in setFormData.imageList" :key="index"> <view class="input_content_photo_adPh" v-for="(item, index) in setFormData.imageList"
:key="index">
<image :src="item" class="myimg2 photos"></image> <image :src="item" class="myimg2 photos"></image>
<view class="input_content_photo_adPh_jiao" @click="deleteImage(index)"> <view class="input_content_photo_adPh_jiao" @click="deleteImage(index)">
<image src="../static/images/close.png" mode=""></image> <image src="../static/images/close.png" mode=""></image>
</view> </view>
</view> </view>
<view v-if="setFormData.imageList.length < 9" class="input_content_photo_adPh addBtn" @click="clk"> <view v-if="setFormData.imageList.length < 9" class="input_content_photo_adPh addBtn"
@click="clk">
<view> <view>
<image src="../static/images/creamer.png" mode="widthFix"></image> <image src="../static/images/creamer.png" mode="widthFix"></image>
</view> </view>
@ -137,7 +139,8 @@
<view><span class="iconfont">&#xe6bd;</span></view> <view><span class="iconfont">&#xe6bd;</span></view>
</view> </view>
</view> </view>
<view class="popup_group_item" @click="setSpecifica" v-if="setFormData.spec_type == 1 && setFormData.specifica"> <view class="popup_group_item" @click="setSpecifica"
v-if="setFormData.spec_type == 1 && setFormData.specifica">
<view class="popup_group_item_label">价格设置</view> <view class="popup_group_item_label">价格设置</view>
<view class="popup_group_item_value"> <view class="popup_group_item_value">
<view class="popup_group_item_message"> <view class="popup_group_item_message">
@ -167,18 +170,20 @@
<view class="popup_group_item_label">是否包邮</view> <view class="popup_group_item_label">是否包邮</view>
<view class="popup_group_item_value"> <view class="popup_group_item_value">
<view class="popup_group_item_message"> <view class="popup_group_item_message">
<switch :checked="setFormData.delivery_free == '1'" color="#E93323" style="transform:scale(0.8)" <switch :checked="setFormData.delivery_free == '1'" color="#E93323"
@change="deliveryFreeChange" /> style="transform:scale(0.8)" @change="deliveryFreeChange" />
</view> </view>
</view> </view>
</view> </view>
<view class="popup_group_item" v-if="setFormData.delivery_way.includes('2') && setFormData.delivery_free == 0" <view class="popup_group_item"
v-if="setFormData.delivery_way.includes('2') && setFormData.delivery_free == 0"
@click="tempIdSelect"> @click="tempIdSelect">
<view class="popup_group_item_label">运费模板</view> <view class="popup_group_item_label">运费模板</view>
<view class="popup_group_item_value"> <view class="popup_group_item_value">
<view class="popup_group_item_message"> <view class="popup_group_item_message">
<span v-if="setFormData.tempName" class="popup_group_item_message_value">{{ setFormData.tempName }}</span> <span v-if="setFormData.tempName"
class="popup_group_item_message_value">{{ setFormData.tempName }}</span>
<span v-else>请选择运费模板</span> <span v-else>请选择运费模板</span>
</view> </view>
<view><span class="iconfont">&#xe6bd;</span></view> <view><span class="iconfont">&#xe6bd;</span></view>
@ -215,11 +220,13 @@
<uni-popup ref="tempId" type="bottom"> <uni-popup ref="tempId" type="bottom">
<linkage-assembly selectProductTitle="选择运费模板" :form="setFormData" :classifiedData="classified['temp_id']" <linkage-assembly selectProductTitle="选择运费模板" :form="setFormData" :classifiedData="classified['temp_id']"
:selectProductItem="productItem" :mer_id="merId" @getLinkageData="getTempIdData" @multipleList="multipleList" :selectProductItem="productItem" :mer_id="merId" @getLinkageData="getTempIdData"
@close="$refs.tempId.close()" @scrolltolower="scrolltolower"></linkage-assembly> @multipleList="multipleList" @close="$refs.tempId.close()"
@scrolltolower="scrolltolower"></linkage-assembly>
</uni-popup> </uni-popup>
<uni-popup ref="attr" type="bottom"> <uni-popup ref="attr" type="bottom">
<attr @close="$refs.attr.close()" :mer_id="merId" :attrList="classified['attr']" @selectAttr="selectAttr"></attr> <attr @close="$refs.attr.close()" :mer_id="merId" :attrList="classified['attr']" @selectAttr="selectAttr">
</attr>
</uni-popup> </uni-popup>
<avatar @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx" selHeight="250upx"> <avatar @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx" selHeight="250upx">
</avatar> </avatar>
@ -254,7 +261,10 @@
import storeClassification from '../components/store_classification.vue'; import storeClassification from '../components/store_classification.vue';
import secound from './secound.vue'; import secound from './secound.vue';
import avatar from "@/components/yq-avatar/yq-avatar.vue"; import avatar from "@/components/yq-avatar/yq-avatar.vue";
import { TOKENNAME, HTTP_REQUEST_URL } from '@/config/app.js'; import {
TOKENNAME,
HTTP_REQUEST_URL
} from '@/config/app.js';
import store from '@/store'; import store from '@/store';
export default { export default {
components: { components: {
@ -383,6 +393,7 @@
}; };
}, },
onLoad(opt) { onLoad(opt) {
console.log(opt);
this.merId = Number(opt.mer_id); this.merId = Number(opt.mer_id);
this.product_id = opt.product_id; this.product_id = opt.product_id;
if (opt.code) { if (opt.code) {
@ -396,6 +407,7 @@
} }
}, },
onShow() { onShow() {
this.setFormData.store_name = ''
this.setFormData.setSpecificaValue = ''; this.setFormData.setSpecificaValue = '';
this.setFormData.setSpecificaValue2 = ''; this.setFormData.setSpecificaValue2 = '';
if (getStorage('singleSpecification')) { if (getStorage('singleSpecification')) {
@ -413,7 +425,12 @@
} }
this.initClasiffy(); this.initClasiffy();
}, },
beforeDestroy() {
console.log('123');
uni.removeStorage({
key: 'addGoodsFormData'
});
},
watch: { watch: {
setFormData: { setFormData: {
handler(val) { handler(val) {
@ -455,15 +472,26 @@
that.deliveryType = res.data.delivery_way.map(String); that.deliveryType = res.data.delivery_way.map(String);
if (!that.product_id) that.setFormData.delivery_way = that.deliveryType; if (!that.product_id) that.setFormData.delivery_way = that.deliveryType;
if (that.deliveryType.length == 2) { if (that.deliveryType.length == 2) {
that.deliveryFreeList = [ that.deliveryFreeList = [{
{ value: '1', name: '到店核销' }, value: '1',
{ value: '2', name: '快递配送' } name: '到店核销'
},
{
value: '2',
name: '快递配送'
}
] ]
} else { } else {
if (that.deliveryType.length == 1 && that.deliveryType[0] == '1') { if (that.deliveryType.length == 1 && that.deliveryType[0] == '1') {
that.deliveryFreeList = [{ value: '1', name: '到店核销' }] that.deliveryFreeList = [{
value: '1',
name: '到店核销'
}]
} else { } else {
that.deliveryFreeList = [{ value: '2', name: '快递配送' }] that.deliveryFreeList = [{
value: '2',
name: '快递配送'
}]
} }
} }
}, },
@ -513,11 +541,13 @@
this.setFormData[item] = editGoodsDetils[item]; this.setFormData[item] = editGoodsDetils[item];
}); });
this.setFormData.product_id = this.product_id; this.setFormData.product_id = this.product_id;
this.setFormData.imageList = [...(this.setFormData.image ? [this.setFormData.image] : []), ...this this.setFormData.imageList = [...(this.setFormData.image ? [this.setFormData.image] : []), ...
this
.setFormData.slider_image .setFormData.slider_image
]; ];
this.setFormData.cate_name = editGoodsDetils.storeCategory.cate_name; // this.setFormData.cate_name = editGoodsDetils.storeCategory.cate_name; //
this.setFormData.mer_cate_name = editGoodsDetils.merCateId ? editGoodsDetils.merCateId.map(item => item this.setFormData.mer_cate_name = editGoodsDetils.merCateId ? editGoodsDetils.merCateId.map(
item => item
.category && item.category.cate_name).join(',') : ''; .category && item.category.cate_name).join(',') : '';
this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : ''; this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : '';
// //
@ -551,7 +581,11 @@
}, },
clk() { clk() {
let avatar = this.$refs.avatar; let avatar = this.$refs.avatar;
avatar.fChooseImg(1, { selWidth: '350upx', selHeight: '350upx', inner: true }); avatar.fChooseImg(1, {
selWidth: '350upx',
selHeight: '350upx',
inner: true
});
}, },
doUpload(rsp) { doUpload(rsp) {
let that = this let that = this
@ -649,7 +683,10 @@
id = item.value; id = item.value;
}); });
// str = str.slice(0, str.length - 1); // str = str.slice(0, str.length - 1);
return { str, id }; return {
str,
id
};
}, },
// //
@ -668,7 +705,10 @@
}, },
// //
selectSpecification() { selectSpecification() {
attrList(this.merId, { page: 1, limit: 10000 }).then(res => { attrList(this.merId, {
page: 1,
limit: 10000
}).then(res => {
if (res.data.list.length < 1) return Toast('暂无规格可选'); if (res.data.list.length < 1) return Toast('暂无规格可选');
this.specificationClassification = res.data.list; this.specificationClassification = res.data.list;
this.classified['attr'] = this.specificationClassification; this.classified['attr'] = this.specificationClassification;
@ -769,7 +809,9 @@
}, },
// //
setGoodsTemp() { setGoodsTemp() {
navigateTo(1, '/pages/product/addGoods/freightTemplate', { mer_id: this.merId }); navigateTo(1, '/pages/product/addGoods/freightTemplate', {
mer_id: this.merId
});
}, },
// //
@ -783,7 +825,9 @@
mer_cate_id: '请选择店铺分类', // mer_cate_id: '请选择店铺分类', //
unit_name: '请输入商品单位', // unit_name: '请输入商品单位', //
}; };
console.log({ ...this.setFormData }) console.log({
...this.setFormData
})
Object.keys(requireData).some(item => { Object.keys(requireData).some(item => {
if (!this.setFormData[item]) { if (!this.setFormData[item]) {
Toast(requireData[item]); Toast(requireData[item]);

View File

@ -105,6 +105,7 @@
} }
}, },
watch: { watch: {
singleSpecification: { singleSpecification: {
handler(val) { handler(val) {
@ -125,6 +126,12 @@
}) })
} }
}, },
// beforeDestroy() {
// console.log('123');
// uni.removeStorage({
// key: 'singleSpecification'
// });
// },
methods: { methods: {
selectMoreThan() { selectMoreThan() {
this.formList = this.formList.concat(this.moreThanList); this.formList = this.formList.concat(this.moreThanList);

View File

@ -203,7 +203,8 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<scroll-view scroll-y="true" v-if="currentNav === 3" class="video-list" <scroll-view scroll-y="true" v-if="currentNav === 3" class="video-list"
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered" @scrolltolower="getGoods()" > :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered"
@scrolltolower="getGoods()">
<block v-for="(item,index) in cateGoods" :key="index"> <block v-for="(item,index) in cateGoods" :key="index">
<view class="goods_item" @click="gogogo(item)"> <view class="goods_item" @click="gogogo(item)">
<image class="goods_img" :src="item.image[0]" mode="aspectFill"></image> <image class="goods_img" :src="item.image[0]" mode="aspectFill"></image>
@ -427,6 +428,7 @@
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options);
this.getOptions(options); this.getOptions(options);
this.videoID = options.id; this.videoID = options.id;
this.isUser = options.user == 1 ? true : false; this.isUser = options.user == 1 ? true : false;
@ -700,7 +702,7 @@
animationfinish(event) { animationfinish(event) {
let that = this let that = this
if (!that.loadVideo || !that.loadMore) return if (!that.loadVideo || !that.loadMore) return
if (this.k == this.dataList.length - 1 && this.currentNav === 1) { if (this.k == this.dataList.length - 1 && this.currentNav == 1) {
that.loadVideo = false that.loadVideo = false
this.get() this.get()
} }
@ -730,10 +732,10 @@
duration: 2000 duration: 2000
}); });
}) : }) :
videoList({ graphicLstApi({
page: that.page, page: that.page,
limit: that.limit, limit: that.limit,
id: that.videoID category_id: -1
}).then(res => { }).then(res => {
that.videoData(res.data.list) that.videoData(res.data.list)
if (res.data.list.length < that.limit) { if (res.data.list.length < that.limit) {

View File

@ -331,11 +331,11 @@
<style lang="scss"> <style lang="scss">
page{background: #ffffff;} page{background: #ffffff;}
.history{ .history{
margin-bottom: 96rpx; margin-bottom: 100rpx;
.history_count{ .history_count{
padding: 0 30rpx 0; padding: 0 30rpx 0;
padding: 0 30rpx calc(0rpx+ constant(safe-area-inset-bottom)); /// IOS<11.2/ padding: 0 30rpx calc(0rpx+ constant(safe-area-inset-bottom)); /// IOS<11.2/
padding: 0 30rpx calc(0rpx + env(safe-area-inset-bottom)); /// IOS>11.2/ padding: 0 30rpx calc(100rpx + env(safe-area-inset-bottom)); /// IOS>11.2/
} }
.history_header{ .history_header{
justify-content: space-between; justify-content: space-between;