更新小程序部分功能

This commit is contained in:
weipengfei 2023-11-01 17:47:43 +08:00
parent 4a1e214501
commit 5cedc225bc
5 changed files with 126 additions and 66 deletions

View File

@ -12,7 +12,8 @@
<view class="list-box listA" :class="goods.length > 0 ? 'fadeIn on' : ''"> <view class="list-box listA" :class="goods.length > 0 ? 'fadeIn on' : ''">
<view class="item" v-for="(item, index) in goods" :key="index"> <view class="item" v-for="(item, index) in goods" :key="index">
<view class="pictrue"> <view class="pictrue">
<easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage> <!-- <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage> -->
<image :src="item.image" :lazy-load="true"></image>
</view> </view>
<view class="text-info"> <view class="text-info">
<view class="title">{{ item.store_name }}</view> <view class="title">{{ item.store_name }}</view>
@ -43,8 +44,25 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<u-modal :show="addGoodsShow" content='是否添加到你的仓库中?' @cancel="addGoodsclose()" @close="addGoodsclose()" <!-- <u-modal :show="addGoodsShow" content='是否添加到你的仓库中?' @cancel="addGoodsclose()" @close="addGoodsclose()"
@confirm="addGoodsopen()" :closeOnClickOverlay="true" :showCancelButton="true"></u-modal> @confirm="addGoodsopen()" :closeOnClickOverlay="true" :showCancelButton="true"></u-modal> -->
<u-popup :show="addGoodsShow" @close="searchGoodsClose" :round="18" mode="center">
<view class="search_goods_box">
<view style="text-align: center;font-weight: bold;">是否添加到你的仓库中?</view>
<view style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">价格:</view>
<input style="flex: 1;" type="text" v-model="putGoods.price" class="putGoods" :placeholder="`请设置商品价格`">
</view>
<view style="display: flex;align-items: center;margin-top: 16rpx;">
<view style="margin-right: 20rpx;">库存:</view>
<input style="flex: 1;" type="text" v-model="putGoods.stock" class="putGoods" placeholder="请输入商品库存">
</view>
<view class="search_goods_btn">
<view class="cancel edit_btn" @click="addGoodsclose()">取消</view>
<view class="search edit_btn" @click="addGoodsopen()">确定</view>
</view>
</view>
</u-popup>
<u-popup :show="searchGoodsShow" @close="searchGoodsClose" :round="18" mode="center"> <u-popup :show="searchGoodsShow" @close="searchGoodsClose" :round="18" mode="center">
<view class="search_goods_box"> <view class="search_goods_box">
<input type="text" v-model="searchGoodsName" class="searchGoods" placeholder="请输入商品名称"> <input type="text" v-model="searchGoodsName" class="searchGoods" placeholder="请输入商品名称">
@ -68,7 +86,7 @@
} from '@/api/store.js' } from '@/api/store.js'
import { import {
seachBarCodeAPI, seachBarCodeAPI,
post_product_import micro_product_import
} from '@/api/api.js' } from '@/api/api.js'
import { import {
Toast Toast
@ -77,7 +95,7 @@
data() { data() {
return { return {
goodsData: [{ goodsData: [{
name: '商品添加', name: '商品名称添加',
type: 1, type: 1,
src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/mingcheng.png' src: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/mingcheng.png'
}, },
@ -96,7 +114,24 @@
mer_id: 0, mer_id: 0,
searchGoodsShow: false, searchGoodsShow: false,
searchGoodsName: '', searchGoodsName: '',
goods: [], goods: [
// {
// "id": 5,
// "store_name": "260 170X118X2605",
// "bar_code": "6940074914381",
// "unit_name": "",
// "price": "0.00",
// "cost": "0.00",
// "ot_price": "0.00",
// "stock": 9999999,
// "image": "127.0.0.1:8324/uploads/img/2023-11-01/1698809432.jpg"
// }
],
putGoods: {
id: '',
price: '',
stock: '',
},
item: [], item: [],
addGoodsShow: false, addGoodsShow: false,
stype: '', stype: '',
@ -105,28 +140,31 @@
onLoad(e) { onLoad(e) {
this.mer_id = e.mer_id this.mer_id = e.mer_id
// this.stype = e.stype // this.stype = e.stype
this.stype = 2 this.stype = 2
if (this.stype == 1) { // if (this.stype == 1) {
return this.goodsData[0].name = '商品添加' // return this.goodsData[0].name = ''
} // }
if (this.stype == 2) { // if (this.stype == 2) {
return this.goodsData[0].name = '商品名称添加' // return this.goodsData[0].name = ''
} // }
}, },
onShow() { onShow() {
}, },
methods: { methods: {
addGoods(item) { addGoods(item) {
this.putGoods.id = item.id;
this.addGoodsShow = true this.addGoodsShow = true
this.item = item this.item = item
}, },
addGoodsopen() { addGoodsopen() {
if (this.item) { if (this.putGoods.id) {
post_product_import(this.item.product_id).then(e => { console.log('开始');
micro_product_import(this.putGoods).then(e => {
if (e.status == 200) { if (e.status == 200) {
Toast(e.data.msg) Toast(e.data.msg)
this.addGoodsShow = false this.addGoodsShow = false
this.putGoods = {};
} else { } else {
// console.log(e); // console.log(e);
Toast(e.message) Toast(e.message)
@ -150,6 +188,8 @@
}, },
openSearch() {}, openSearch() {},
async searchGoodsClose() { async searchGoodsClose() {
console.log('搜索', this.searchGoodsName);
if(this.searchGoodsName=='') return Toast('请输入商品名称');
const rq = { const rq = {
mer_id: this.mer_id, mer_id: this.mer_id,
name: this.searchGoodsName name: this.searchGoodsName
@ -222,6 +262,7 @@
code: code, code: code,
mer_id: this.mer_id mer_id: this.mer_id
}).then(res => { }).then(res => {
console.log(res);
if (!res.data) { if (!res.data) {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
@ -312,6 +353,13 @@
padding: 12px; padding: 12px;
margin: 21.05rpx 0; margin: 21.05rpx 0;
} }
.putGoods {
height: 87.72rpx;
border: 1px solid #f5f5f5;
border-radius: 8px;
padding: 12px;
}
.search_goods_btn { .search_goods_btn {
margin-top: 28.07rpx; margin-top: 28.07rpx;

View File

@ -4,11 +4,6 @@
<view class="content_list"> <view class="content_list">
<view class="content_list_item"> <view class="content_list_item">
<view>商品详情</view> <view>商品详情</view>
<!-- <view class="content_list_item_han">
<span v-if="disModel" style="color: #000000">去修改</span>
<span v-else>设置详情</span>
<span class="iconfont">&#xe6bd;</span>
</view> -->
</view> </view>
<input-goods-detils class="input-goods-detils" @getProductContent="getProductContent" :title="store_name" :prodectContent="goodsDis" :maxLength="200"></input-goods-detils> <input-goods-detils class="input-goods-detils" @getProductContent="getProductContent" :title="store_name" :prodectContent="goodsDis" :maxLength="200"></input-goods-detils>
<block v-if="!moreThanFlag"> <block v-if="!moreThanFlag">

View File

@ -3,7 +3,7 @@
<view class="step_one" v-if="step == 1"> <view class="step_one" v-if="step == 1">
<view class="input_content"> <view class="input_content">
<view class="bar-code" v-if="bar_code_dis"> <view class="bar-code" v-if="bar_code_dis">
<view>商品</view> <view>商品</view>
<!-- <view>{{ singleSpecification.bar_code }}</view> --> <!-- <view>{{ singleSpecification.bar_code }}</view> -->
<input type="number" placeholder="请手动添加条码" v-model="code" :disabled="bar_code_dis" <input type="number" placeholder="请手动添加条码" v-model="code" :disabled="bar_code_dis"
placeholder-class="inputPlaceHolder" /> placeholder-class="inputPlaceHolder" />
@ -11,14 +11,16 @@
<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="请输入商品名称" placeholder-class="placeholderStyle"
maxlength="60" /> maxlength="60" />
<view> <view class="flex" style="justify-content: space-between;color: #999999;">
<text v-if="setFormData.store_name">{{ setFormData.store_name.length }}</text> <view>(品牌,名称,规格,口味)</view>
<text v-else>0</text> <view>
/60 <text v-if="setFormData.store_name">{{ setFormData.store_name.length }}</text>
<text v-else>0</text>/60
</view>
</view> </view>
</view> </view>
<view class="photo_count"> <view class="photo_count">
<text class="photo_size">建议图片尺寸为750*750px, 上传2张以上</text> <text class="photo_size" style="color: #e93323;">建议图片尺寸为750*750px, 上传2张以上</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" @click="pop(item)"></image> <image :src="item" class="myimg2 photos" @click="pop(item)"></image>
@ -84,7 +86,7 @@
</view> </view>
</view> </view>
<priceComponent :product_id="product_id" v-if="showCommodity"></priceComponent> <priceComponent :product_id="product_id" :bar_code="code" @updateCode = "updateCode" v-if="showCommodity"></priceComponent>
<!-- <view class="popup_group"> <!-- <view class="popup_group">
<view class="radio"> <view class="radio">
@ -168,15 +170,15 @@
</commodityComponent> </commodityComponent>
<view class="popup_group"> <view class="popup_group">
<view class="popup_group_item" @click="showMoreInfo=!showMoreInfo"> <!-- <view class="popup_group_item" @click="showMoreInfo=!showMoreInfo">
<view class="popup_group_item_label">更多信息</view> <view class="popup_group_item_label">更多信息</view>
<view class="popup_group_item_value" :class="showMoreInfo?'icon_bottom':'icon_top'"> <view class="popup_group_item_value" :class="showMoreInfo?'icon_bottom':'icon_top'">
<view><span class="iconfont">&#xe6bd;</span></view> <view><span class="iconfont">&#xe6bd;</span></view>
</view> </view>
</view> </view> -->
<block v-if="showMoreInfo"> <block >
<view class="input_content"> <view class="input_content">
<view class="input_content_describe" style="border-top: none"> <!-- <view class="input_content_describe" style="border-top: none">
<view class="input_content_describe_title"> <view class="input_content_describe_title">
<view class="input_content_describe_title_msg">商品简介</view> <view class="input_content_describe_title_msg">商品简介</view>
<view class="input_content_describe_title_num"> <view class="input_content_describe_title_num">
@ -189,7 +191,7 @@
<textarea v-model="setFormData.store_info" value="" placeholder="请填写商品简介" <textarea v-model="setFormData.store_info" value="" placeholder="请填写商品简介"
placeholderClass="placeholderClass" maxlength="200" /> placeholderClass="placeholderClass" maxlength="200" />
</view> </view>
</view> </view> -->
<view class="input_content_keyword"> <view class="input_content_keyword">
<view class="input_content_keyword_label">关键字</view> <view class="input_content_keyword_label">关键字</view>
@ -799,6 +801,10 @@
return; return;
} }
}, },
//
updateCode(e){
this.code = e + '';
},
// //
// switch // switch
switchChange(value, item) { switchChange(value, item) {

View File

@ -22,14 +22,14 @@
components: { components: {
selectForm selectForm
}, },
props: ['product_id'], props: ['product_id', 'bar_code'],
data() { data() {
return { return {
singleSpecification: { singleSpecification: {
price: '', // price: '', //
cost: '', // cost: '', //
stock: '', // stock: '', //
ot_price: '', // ot_price: '', //
bar_code: '', // bar_code: '', //
weight: '', // weight: '', //
volume: '', // volume: '', //
@ -39,53 +39,60 @@
}, },
moreThanFlag: true, moreThanFlag: true,
formList: [{ formList: [{
id: 1, id: 1,
label: '售价', label: '售价',
type: 'digit', type: 'digit',
model: 'price', model: 'price',
holder: '请填写售价' holder: '请填写售价',
}, { require: true,
id: 10, }, {
label: '库存', id: 10,
type: 'digit', label: '库存',
model: 'stock', type: 'digit',
holder: '请填写库存', model: 'stock',
disable: true holder: '请填写库存',
}], disable: true,
moreThanList: [{ require: true,
}, {
id: 2, id: 2,
label: '成本价', label: '成本价',
type: 'digit', type: 'digit',
holder: '请填写成本价', holder: '请填写成本价',
model: 'cost' model: 'cost',
require: true,
}, },
{ {
id: 3, id: 3,
label: '价', label: '批发价',
type: 'digit', type: 'digit',
holder: '请填写原价', holder: '请填写批发价',
model: 'ot_price' model: 'ot_price',
}, require: true,
{ }
id: 5, ],
label: '商品条码', moreThanList: [{
type: 'input',
holder: '请填写商品条码',
model: 'bar_code'
},
{
id: 6, id: 6,
label: '重量', label: '重量',
type: 'digit', type: 'digit',
holder: '请输入重量', holder: '请输入重量',
model: 'weight' model: 'weight',
require: false,
}, },
{ {
id: 7, id: 7,
label: '体积', label: '体积',
type: 'digit', type: 'digit',
holder: '请输入体积', holder: '请输入体积',
model: 'volume' model: 'volume',
require: false,
},
{
id: 5,
label: '商品条码',
type: 'input',
holder: '请填写商品条码',
model: 'bar_code',
require: false,
}, },
// { // {
// id: 8, // id: 8,
@ -108,12 +115,13 @@
watch: { watch: {
singleSpecification: { singleSpecification: {
handler(val) { handler(val, old) {
this.singleSpecification = val; this.singleSpecification = val;
this.saveSingleSpecification(); this.saveSingleSpecification();
this.$emit('updateCode', val.bar_code);
}, },
deep: true deep: true
} },
}, },
// onLoad(option) { // onLoad(option) {
// console.log(option); // console.log(option);
@ -148,6 +156,7 @@
} }
}) })
} }
this.singleSpecification.bar_code = this.$props.bar_code + '';
// if (!this.$props.product_id) { // if (!this.$props.product_id) {
// this.formList.push({ // this.formList.push({
// id: 10, // id: 10,
@ -170,7 +179,7 @@
spliceMoreThan() { spliceMoreThan() {
this.moreThanFlag = true; this.moreThanFlag = true;
// this.formList.splice(!this.$props.product_id ? 2 : 1, this.formList.length); // this.formList.splice(!this.$props.product_id ? 2 : 1, this.formList.length);
this.formList.splice(2, this.formList.length); this.formList.splice(4, this.formList.length);
}, },
input(val) { input(val) {
this.singleSpecification = val this.singleSpecification = val

View File

@ -271,6 +271,8 @@
if(!postData.unit_name||postData.unit_name?.trim().length<=0)return Toast('请输入商品单位'); if(!postData.unit_name||postData.unit_name?.trim().length<=0)return Toast('请输入商品单位');
if(!postData.attrValue[0]?.price||postData.attrValue[0]?.price<0)return Toast('价格不能小于0'); if(!postData.attrValue[0]?.price||postData.attrValue[0]?.price<0)return Toast('价格不能小于0');
if(!postData.stock||postData.stock<0)return Toast('库存不能小于0'); if(!postData.stock||postData.stock<0)return Toast('库存不能小于0');
if(!postData.attrValue[0]?.cost||postData.attrValue[0]?.cost<0)return Toast('成本价不能小于0');
if(!postData.attrValue[0]?.ot_price||postData.attrValue[0]?.ot_price<0)return Toast('批发价不能小于0');
// if(!postData.content.title||postData.content.title?.trim().length<=0)return Toast(''); // if(!postData.content.title||postData.content.title?.trim().length<=0)return Toast('');
// if(!postData.content.image||postData.content.image?.length<=0)return Toast(''); // if(!postData.content.image||postData.content.image?.length<=0)return Toast('');
// return Toast(''); // return Toast('');