This commit is contained in:
zmj 2024-04-20 14:51:26 +08:00
parent 56921854dd
commit 9cb77a57e4
7 changed files with 317 additions and 217 deletions

34
api/common.js Normal file
View File

@ -0,0 +1,34 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from "@/utils/request.js";
/**
* 获取省份
*/
export function getProvince() {
return request.get("city/get_province");
}
/**
* 获取省份
*/
export function getCity(data) {
return request.get("city/get_city", data);
}
/**
* 获取省份
*/
export function getArea(data) {
return request.get("city/get_area", data);
}

View File

@ -160,12 +160,21 @@ export function categorySearch(merId, data) {
添加修改商品 热门分类商品 添加修改商品 热门分类商品
*/ */
export function categoryHotcate(merId, data) { export function categorySearchHistory(merId, uid, data) {
return request.get(`server/${merId}/category/hotcate`, data, { return request.post(`server/${merId}/category/search_history/${uid}`, data, {
login: true login: true
}) })
} }
/*
添加修改商品 添加热门分类商品
*/
export function categoryHotcate(merId, uid) {
return request.get(`server/${merId}/category/hotcate/${uid}`, {
login: true
})
}
/* /*
商品管理 添加商品 商品管理 添加商品

View File

@ -7,7 +7,7 @@
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text> <text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text>
</u-form-item> </u-form-item>
<u-line></u-line> <u-line></u-line>
<u--textarea v-model="formData.store_name" placeholder="请输入内容" :autoHeight='true' <u--textarea v-model="formData.cate_name" placeholder="请输入内容" :autoHeight='true'
:maxlength='maxLength'></u--textarea> :maxlength='maxLength'></u--textarea>
</view> </view>
<view class="card" style="min-height: 268rpx;"> <view class="card" style="min-height: 268rpx;">
@ -146,9 +146,8 @@
], ],
selfAttr: "", selfAttr: "",
formData: { formData: {
store_name: "", // store_name: "",
imageList: [], imageList: [],
attrValue: [],
cate_name: "", cate_name: "",
cate_id: "", cate_id: "",
attrValue: [{ attrValue: [{
@ -157,9 +156,12 @@
"wholesale_unit_name": "", "wholesale_unit_name": "",
"wholesale_price": '', "wholesale_price": '',
"stock": "", "stock": "",
open: true,
spec_type: '单规格'
}], }],
product_attribute: [], image: '',
spec_type: "0" slider_image: [],
// product_attribute: [],
}, },
showPouple: false, showPouple: false,
fileList6: [], fileList6: [],
@ -169,9 +171,6 @@
value4: "", value4: "",
maxLength: 30, maxLength: 30,
showSex: false, showSex: false,
rules: { rules: {
title: { title: {
type: 'string', type: 'string',
@ -264,9 +263,12 @@
}) })
}, },
async submit() { async submit() {
// this.formData.imageList = this.formData.imageList.map(item => item.url) let data = uni.$u.deepClone(this.formData)
// await this.$refs.formData.validate() data.imageList = data.imageList.map(item => item.url)
productCreate(this.mer_id, this.formData) data.image = data.imageList[0]
data.slider_image = data.imageList.splice(0, 1)
data.store_name = data.cate_name
productCreate(this.mer_id, data)
.then(res => { .then(res => {
hideLoading(); hideLoading();
Modal('提交成功', '点击确定,前往商品列表页面').then(() => { Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
@ -292,12 +294,8 @@
if (option.data) { if (option.data) {
this.formData.cate_name = JSON.parse(option.data).label this.formData.cate_name = JSON.parse(option.data).label
this.formData.cate_id = JSON.parse(option.data).value this.formData.cate_id = JSON.parse(option.data).value
console.log(option.data)
} }
}, },
}; };
</script> </script>
<style lang='scss'> <style lang='scss'>

View File

@ -7,7 +7,7 @@
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text> <text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text>
</u-form-item> </u-form-item>
<u-form-item label="" prop="userInfo.name" ref="item1"> <u-form-item label="" prop="userInfo.name" ref="item1">
<u--textarea v-model="value1" placeholder="建议描述产品品牌、名称、规格、口味" <u--textarea v-model="formData.store_name" placeholder="建议描述产品品牌、名称、规格、口味"
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true' style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
:maxlength='maxLength'></u--textarea> :maxlength='maxLength'></u--textarea>
</u-form-item> </u-form-item>
@ -54,8 +54,10 @@
</u-form-item> </u-form-item>
<u-form-item label="商品属性" prop="userInfo.name" ref="item1" labelPosition="left"> <u-form-item label="商品属性" prop="userInfo.name" ref="item1" labelPosition="left">
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right" <view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
@click="navgo('/pages/product/addGoodDetail/goodsAttr')"> @click="navgo(`/pages/product/addGoodDetail/goodsAttr?attr=${JSON.stringify(formData.attribute) }`)">
<view style="margin-right: 10rpx;line-height: 25rpx;">去设置</view> <view style="margin-right: 10rpx;line-height: 25rpx;">
{{Object.values(formData.attribute).length ?"已设置":"未设置"}}
</view>
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
@ -63,14 +65,40 @@
<view class='tips'> <view class='tips'>
规格与价格 规格与价格
</view> </view>
<view class="card" style="height: 100rpx;padding: 14rpx 30rpx;"> <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="userInfo.name" ref="item1" labelPosition="left" required border-bottom>
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right" <view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
@click="navgo('/pages/product/addGoodDetail/goodsPrice')"> @click="navgo(`/pages/product/addGoodDetail/goodsPrice?attrValue=${JSON.stringify(formData.attrValue)}`)">
<view style="margin-right: 10rpx;line-height: 25rpx;">去设置</view> <view style="margin-right: 10rpx;line-height: 25rpx;">去设置</view>
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
<view class="" v-for="(item,index) in formData.attrValue.filter(item=> item.open)">
<u-form-item :label="item.spec_type" label-width="350rpx" prop="userInfo.name" ref="item1"
labelPosition="left" border-bottom>
<view class="" style="display: flex;justify-content: space-between;width: 100%">
<view style="font-size: 28rpx;color:#777777 ;">
零售价
</view>
<view style="font-size: 28rpx;color:#777777 ;">
{{item.price}}/{{item.unit_name}}
</view>
</view>
</u-form-item>
<u-form-item label=" " label-width="350rpx" prop="userInfo.name" ref="item1" labelPosition="left"
border-bottom>
<view class="" style="display: flex;justify-content: space-between;width: 100%">
<view style="font-size: 28rpx;color:#777777 ;">
批发价
</view>
<view style="font-size: 28rpx;color:#777777 ;">
<!-- 8/ -->
{{item.wholesale_price}}/{{item.wholesale_unit_name}}
</view>
</view>
</u-form-item>
</view>
</view> </view>
<view class='tips'> <view class='tips'>
服务与承诺 服务与承诺
@ -85,9 +113,9 @@
<u-line color="#F3F3F3" style="margin: 30rpx 0;"></u-line> <u-line color="#F3F3F3" style="margin: 30rpx 0;"></u-line>
<u-form-item label="送货方式" labelPosition="left" required> <u-form-item label="送货方式" labelPosition="left" required>
<u-checkbox-group v-model="checkboxValue1" placement="row" slot="right"> <u-checkbox-group v-model="formData.delivery_way" placement="row" slot="right">
<u-checkbox shape="circle" v-for="(item, index) in checkboxList1" :key="index" <u-checkbox shape="circle" v-for="(item, index) in checkboxList1" :key="index"
:label="item.name" :name="item.name" activeColor="#20B128" :label="item.name" :name="item.value" activeColor="#20B128"
:customStyle="{marginRight: '8px'}" :customStyle="{marginRight: '8px'}"
:labelColor="checkboxValue1.includes(item.name)?'#20B128':'#777777'"> :labelColor="checkboxValue1.includes(item.name)?'#20B128':'#777777'">
</u-checkbox> </u-checkbox>
@ -159,21 +187,9 @@
"imageList": [ "imageList": [
], ],
"attrValue": [{ "attrValue": [
"price": "100",
"unit_name": "箱", ],
"wholesale_unit_name": "件",
"wholesale_price": 88,
"cost": "",
"stock": "20",
"ot_price": "",
"procure_price": "",
"bar_code": "",
"weight": "",
"volume": "",
"extension_one": "",
"extension_two": ""
}],
"cate_name": "兽药", "cate_name": "兽药",
"unit_name": "件", "unit_name": "件",
"cate_id": 1826, "cate_id": 1826,
@ -184,10 +200,7 @@
"spec_type": "0", "spec_type": "0",
"attr": [], "attr": [],
"specifica": "", "specifica": "",
"delivery_way": [ "delivery_way": [],
1,
2
],
"delivery_free": "1", "delivery_free": "1",
"temp_id": "", "temp_id": "",
"tempName": "", "tempName": "",
@ -205,7 +218,8 @@
"title": "", "title": "",
"image": [] "image": []
}, },
"stock": "20" "stock": "20",
attribute: {},
}, },
mer_id: "", mer_id: "",
maxLength: 30, maxLength: 30,
@ -238,9 +252,11 @@
checkboxValue1: [], checkboxValue1: [],
checkboxList1: [{ checkboxList1: [{
name: '到店核销', name: '到店核销',
value: 1,
}, },
{ {
name: '快递配送', name: '快递配送',
value: 2,
}, },
], ],
@ -356,18 +372,29 @@
}, },
submit() { submit() {
console.log(this.formData) console.log(this.formData)
} },
getAttr(object) {
this.formData.attribute = object
},
getAttrValue(object) {
this.formData.attrValue = object
console.log(this.formData.attrValue)
},
}, },
onLoad(option) { onLoad(option) {
this.mer_id = option.mer_id this.mer_id = option.mer_id
if (option.typeData) { if (option.typeData) {
this.formData.cate_name = JSON.parse(option.typeData).label this.formData.cate_name = JSON.parse(option.typeData).label
this.formData.cate_id = JSON.parse(option.typeData).value this.formData.cate_id = JSON.parse(option.typeData).value
console.log(this.formData, 'option')
} }
if (option.formData) { if (option.formData) {
Object.assign(this.formData, JSON.parse(option.formData), {}) let data = JSON.parse(option.formData)
for (let key in data) {
this.formData[key] = data[key]
}
console.log(this.formData)
} }
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="content"> <view class="content">
<u--form :model="model1" :rules="rules" ref="uForm" labelPosition="left" <u--form :model="model1" ref="uForm" labelPosition="left" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
:labelStyle="{fontSize:'32rpx',color:'#444444'}" labelWidth='120' borderBottom> labelWidth='120' borderBottom>
<view class="description"> <view class="description">
产品属性 产品属性
@ -9,8 +9,8 @@
<view class="label-cls"> <view class="label-cls">
<u-form-item label="产地" prop="userInfo.name" ref="item1"> <u-form-item label="产地" prop="userInfo.name" ref="item1">
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right" <view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
@click="showPouple=true,popType='place'"> @click="showPouple=true,popType='place',getLocation()">
<view style="margin-right: 10rpx;line-height: 25rpx;">请选择</view> <view style="margin-right: 10rpx;line-height: 25rpx;">{{formData.address||'请选择'}}</view>
<u-icon name="arrow-right"></u-icon> <u-icon name="arrow-right"></u-icon>
</view> </view>
</u-form-item> </u-form-item>
@ -32,33 +32,34 @@
</view> </view>
<view class="description" style="display: flex;justify-content: space-between;align-items: center"> <view class="description" style="display: flex;justify-content: space-between;align-items: center">
<text>产品属性</text> <text>产品属性</text>
<view class="attr-custom" @click="attr.push({label:'',value:''})"> <view class="attr-custom" @click="formData.attr.push({label:'',value:''})">
<u-icon name="plus" color='#20B128' style="margin-right: 8rpx;font-weight: bold;"></u-icon> <u-icon name="plus" color='#20B128' style="margin-right: 8rpx;font-weight: bold;"></u-icon>
</view> </view>
</view> </view>
<view class="label-cls" <view class="label-cls"
style="display: flex;padding: 20rpx 20rpx 20rpx 2rpx;justify-content: space-between;margin-bottom: 30rpx;" style="display: flex;padding: 20rpx 20rpx 20rpx 2rpx;justify-content: space-between;margin-bottom: 30rpx;"
v-for="(item,index) in attr"> v-for="(item,index) in formData.attr">
<view class="" style="display: flex;width: 70%;align-items: center;"> <view class="" style="display: flex;width: 70%;align-items: center;">
<u--input placeholder="请填写属性名称" border="surround" v-model="item.label"></u--input> <u--input placeholder="请填写属性名称" border="surround" v-model="item.label"></u--input>
<u-line direction="col" length="40rpx" color="#CECECE"></u-line> <u-line direction="col" length="40rpx" color="#CECECE"></u-line>
<u--input placeholder="请填写属性值" border="surround" v-model="item.value"></u--input> <u--input placeholder="请填写属性值" border="surround" v-model="item.value"></u--input>
<u-line direction="col" length="40rpx" color="#CECECE"></u-line> <u-line direction="col" length="40rpx" color="#CECECE"></u-line>
</view> </view>
<view style="color: #777777;display: flex; align-items: center;" @click="attr.splice(index, 1);"> <view style="color: #777777;display: flex; align-items: center;"
@click="formData.attr.splice(index, 1);">
<u-icon name="trash" style='margin-right: 8rpx;'></u-icon> <u-icon name="trash" style='margin-right: 8rpx;'></u-icon>
</view> </view>
</view> </view>
</u--form> </u--form>
<view class="submit-btn"> <view class="submit-btn">
<u-button type="primary" shape="circle" text="保存"></u-button> <u-button type="primary" shape="circle" text="保存" @click="submit"></u-button>
</view> </view>
<u-popup :show="showPouple" @close="showPouple=false" @open="showPouple=true" :round="10"> <u-popup :show="showPouple" @close="showPouple=false,positionType=0" @open="showPouple=true" :round="10">
<view class="RegularFont" style="padding: 42rpx 40rpx"> <view class="RegularFont" style="padding: 42rpx 40rpx">
<view class="pop-head"> <view class="pop-head">
<text v-if="popType=='place' || !show " @click="showPouple=false">取消</text> <text v-if="popType=='place' || !show " @click="showPouple=false,positionType=0">取消</text>
<text v-else @click="show=false"><u-icon name="arrow-left" size="20"></u-icon></text> <text v-else @click="show=false"><u-icon name="arrow-left" size="20"></u-icon></text>
<text <text
style="font-size:32rpx ;color:#333333 ;">{{popType=='place'?'商品产地': popType=='leval'?'商品等级':'商品包装' }} style="font-size:32rpx ;color:#333333 ;">{{popType=='place'?'商品产地': popType=='leval'?'商品等级':'商品包装' }}
@ -82,11 +83,11 @@
:style="{color:positionType==0?'#20B128':'#707070'} "> :style="{color:positionType==0?'#20B128':'#707070'} ">
{{address.province||'请选择' }} {{address.province||'请选择' }}
</view> </view>
<view class="province-li" @click='positionType=1,positionList=cityList' <view class="province-li" @click='choseCity'
:style="{color:positionType==1?'#20B128':'#707070'} "> :style="{color:positionType==1?'#20B128':'#707070'} ">
{{address.city ||'请选择'}} {{address.city ||'请选择'}}
</view> </view>
<view class="province-li" @click='positionType=2,positionList=districtList' <view class="province-li" @click='choseArea'
:style="{color:positionType==2?'#20B128':'#707070'} "> :style="{color:positionType==2?'#20B128':'#707070'} ">
{{address.district ||'请选择'}} {{address.district ||'请选择'}}
</view> </view>
@ -97,12 +98,13 @@
请选择 请选择
</view> </view>
<view class="position-content"> <view class="position-content">
<view class="position-li" :class="{act:address['province']==item}" v-for="item in positionList"
@click="chosePosition(item)"> <view class="position-li" :class="{act:address[wacthType()]==item.name}"
v-for="item in positionList" @click="chosePosition(item)">
<text> <text>
{{item}} {{item.name}}
</text> </text>
<u-icon v-if='address.province==item' name="checkbox-mark" color="#38BE41" <u-icon v-if='address[wacthType()]==item.name' name="checkbox-mark" color="#38BE41"
style='margin-left: 8rpx;'></u-icon> style='margin-left: 8rpx;'></u-icon>
</view> </view>
@ -164,71 +166,22 @@
import { import {
getGeocoder, getGeocoder,
} from '@/api/store.js'; } from '@/api/store.js';
import {
getProvince,
getCity,
getArea
} from "@/api/common.js"
import {
formatDate
} from '../../../libs/uniApi';
export default { export default {
data() { data() {
return { return {
provinceList: [ provinceList: [],
"北京市", cityList: [],
"天津市", districtList: [],
"河北省",
"山西省",
"内蒙古自治区",
"辽宁省",
"吉林省",
"黑龙江省",
"上海市",
"江苏省",
"浙江省",
"安徽省",
"福建省",
"江西省",
"山东省",
"河南省",
"湖北省",
"湖南省",
"广东省",
"广西壮族自治区",
"海南省",
"重庆市",
"四川省",
"贵州省",
"云南省",
"西藏自治区",
"陕西省",
"甘肃省",
"青海省",
"宁夏回族自治区",
"新疆维吾尔自治区",
"台湾省",
"香港特别行政区",
"澳门特别行政区"
],
cityList: [
"成都市",
"自贡市",
"攀枝花市",
"泸州市",
"德阳市",
"绵阳市",
"广元市",
"遂宁市",
"内江市",
"乐山市",
"南充市",
"眉山市",
"宜宾市",
"广安市",
"达州市",
"雅安市",
"巴中市",
"资阳市",
"阿坝藏族羌族自治州",
"甘孜藏族自治州",
"凉山彝族自治州"
],
districtList: ['江阳区', '牛马塔努', '需用唉', '泸县'],
positionList: [], positionList: [],
areaList: [], areaList: [],
districtList: [], districtList: [],
@ -237,27 +190,27 @@
}, },
selfLeval: "", selfLeval: "",
levalList: [ levalList: [
"撒旦", "优等品",
"撒旦", "一等品",
"撒旦", "合格品",
"撒旦",
], ],
selfPack: "", selfPack: "",
packList: [ packList: [
"纸箱子", "盒装",
"纸箱子", "箱装",
"纸箱子", "袋装",
"盆装",
"泡沫箱"
], ],
address: { address: {
province: '', province: '',
province_code: '',
city: "", city: "",
district: "" city_code: "",
district: "",
district_code: ""
}, },
attr: [{
label: "",
value: ''
}],
show: false, show: false,
popType: 'leval', popType: 'leval',
showPouple: false, showPouple: false,
@ -265,8 +218,13 @@
positionType: 0, positionType: 0,
formData: { formData: {
address: "",
leval: "", leval: "",
pack: "", pack: "",
attr: [{
label: "",
value: ''
}]
}, },
model1: { model1: {
@ -275,38 +233,11 @@
sex: '', sex: '',
}, },
}, },
value1: "",
value: '',
text: "",
text1: "",
value1: "",
checkboxValue1: [],
checkboxList1: [{
name: '到店核销',
},
{
name: '快递配送',
},
],
rules: {
// 'userInfo.name': {
// type: 'string',
// required: true,
// message: '',
// trigger: ['blur', 'change']
// },
// 'userInfo.sex': {
// type: 'string',
// max: 1,
// required: true,
// message: '',
// trigger: ['blur', 'change']
// },
},
radio: '',
switchVal: false
}; };
}, },
methods: { methods: {
@ -321,7 +252,7 @@
}, },
confirm() { confirm() {
if (this.popType == 'place') { if (this.popType == 'place') {
console.log('') this.formData.address = this.address.province + this.address.city + this.address.district
} else if (this.popType == 'leval') { } else if (this.popType == 'leval') {
this.levalList.push(this.selfLeval) this.levalList.push(this.selfLeval)
this.formData.leval = this.levalList[this.levalList.length - 1] this.formData.leval = this.levalList[this.levalList.length - 1]
@ -336,10 +267,45 @@
this.showPouple = false this.showPouple = false
}, },
chosePosition(item) { chosePosition(item) {
this.address.province = item if (this.positionType == 0) {
this.address.city = '' this.address.province = item.name
this.address.district = '' this.address.province_code = item.code
this.address.city = ''
this.address.district = ''
} else if (this.positionType == 1) {
this.address.city = item.name
this.address.city_code = item.code
this.address.district = ''
console.log(this.address)
} else {
this.address.district = item.name
this.address.district_code = item.code
}
},
wacthType() {
if (this.positionType == 0) return "province";
else if (this.positionType == 1) return "city";
else if (this.positionType == 2) return "district";
},
choseCity() {
this.positionType = 1;
getCity({
province_code: this.address.province_code
}).then(res => {
this.cityList = res.data
this.positionList = this.cityList
})
},
choseArea() {
this.positionType = 2;
getArea({
city_code: this.address.city_code
}).then(res => {
this.areaList = res.data
this.positionList = this.areaList
})
}, },
getLocation() { getLocation() {
let that = this let that = this
@ -352,9 +318,11 @@
}).then(res1 => { }).then(res1 => {
that.address = res1.data.address_component that.address = res1.data.address_component
that.positionList = that.provinceList that.positionList = that.provinceList
// this.$store.commit('setLocation', res.data) that.provinceList.forEach(item => {
// this.street = res.data.address_component.street if (that.address.province == item.name) {
console.log(that.address, 'res') that.address.province_code = item.code
}
})
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err, title: err,
@ -365,11 +333,23 @@
} }
}); });
},
submit() {
let pages = getCurrentPages(); //
let nowPage = pages[pages.length - 1]; //
let prevPage = pages[pages.length - 2]; //
let object = this.formData
prevPage.getAttr(object) // otherFun,object
uni.navigateBack()
} }
}, },
onLoad() { onLoad(option) {
this.getLocation() getProvince().then(res => {
this.provinceList = res.data
})
if (Object.values(JSON.parse(option.attr)).length) {
this.formData = JSON.parse(option.attr)
}
} }
}; };

View File

@ -1,50 +1,67 @@
<template> <template>
<view class="content"> <view class="content">
<view class=""> <view class="">
<u-button icon="plus" text="新增规格" class="custom-style" iconColor='#38BE41'></u-button> <u-button icon="plus" text="新增规格" @click="attrValue.push({})" class="custom-style"
iconColor='#38BE41'></u-button>
</view> </view>
<view class="card"> <view class="card" v-for="(item,index) in attrValue">
<view class="card-head card-li"> <view class="card-head card-li">
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格1</text> <text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
<view class="" style="width: 200rpx;"> <view class="" style="width: 200rpx;">
<u--input placeholder="请输入规格名称" v-model="text"></u--input> <u--input placeholder="请输入规格名称" v-model="item.spec_type"></u--input>
</view> </view>
</view> </view>
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line> <u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
<view class="" style="display: flex;align-items: center;justify-content: space-between;">
<u--input style="flex: 2; background-color: #F6F6F6;" placeholder="请输入商品单价" v-model="text"></u--input> <view class="">
<view class="" style="flex: 1;text-align: center;"> <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>
<view class="" style="flex: 1;text-align: center;">
/
</view>
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
v-model="item.unit_name"></u--input>
</view>
<view class=""
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>
<view class="" style="flex: 1;text-align: center;">
/
</view>
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
v-model="item.wholesale_unit_name"></u--input>
</view> </view>
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
v-model="text"></u--input>
</view> </view>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line> <u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class=" card-li"> <view class=" card-li">
<text style="font-size: 32rpx;">商品库存</text> <text style="font-size: 32rpx;">商品库存</text>
<view class="" style="width: 200rpx;"> <view class="" style="width: 200rpx;">
<u--input placeholder="请填写库存数量" v-model="text"></u--input> <u--input placeholder="请填写库存数量" v-model="item.stock"></u--input>
</view> </view>
</view> </view>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line> <u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class=" card-li"> <view class=" card-li">
<text style="font-size: 32rpx;">条形码</text> <text style="font-size: 32rpx;">条形码</text>
<view class="" style="width: 200rpx;"> <view class="" style="width: 200rpx;">
<u--input placeholder="请填写商品条形码" v-model="text"></u--input> <u--input placeholder="请填写商品条形码" v-model="item.bar_code"></u--input>
</view> </view>
</view> </view>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line> <u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class="card-li"> <view class="card-li">
<view style="display: flex;color: #777777;"> <view style="display: flex;color: #777777;" @click="attrValue.splice(index,1)">
<u-icon name="trash" style='margin-right: 8rpx;'></u-icon> <u-icon name="trash" style='margin-right: 8rpx;'></u-icon>
</view> </view>
<view class="" style="display: flex;align-items: center;"> <view class="" style="display: flex;align-items: center;">
<u-switch v-model="value" type='primaryy' activeColor="#38BE41" size="19"></u-switch> <u-switch v-model="item.open" type='primaryy' activeColor="#38BE41" size="19"></u-switch>
<text style="margin-left: 8rpx;color: #777777;">启用</text> <text style="margin-left: 8rpx;color: #777777;">启用</text>
</view> </view>
</view> </view>
</view> </view>
<view class="submit-btn">
<u-button type="primary" shape="circle" text="保存" @click="submit"></u-button>
</view>
</view> </view>
</template> </template>
@ -53,7 +70,42 @@
data() { data() {
return { return {
text: "", text: "",
value: "" value: "",
attrValue: [{
spec_type: "",
"price": "100",
"unit_name": "箱",
"wholesale_unit_name": "件",
"wholesale_price": 88,
"cost": "",
"stock": "20",
"ot_price": "",
"procure_price": "",
"bar_code": "5656",
"weight": "",
"volume": "",
"extension_one": "",
"extension_two": "",
open: false
},
],
}
},
methods: {
submit() {
let pages = getCurrentPages(); //
let nowPage = pages[pages.length - 1]; //
let prevPage = pages[pages.length - 2]; //
let object = this.attrValue
prevPage.getAttrValue(object) // otherFun,object
uni.navigateBack()
}
},
onLoad(option) {
if (Object.values(JSON.parse(option.attrValue)).length) {
this.attrValue = JSON.parse(option.attrValue)
} }
} }
@ -106,5 +158,10 @@
border-radius: 4rpx 4rpx 4rpx 4rpx; border-radius: 4rpx 4rpx 4rpx 4rpx;
} }
.submit-btn {
position: fixed;
bottom: 50rpx;
width: 670rpx;
}
} }
</style> </style>

View File

@ -9,23 +9,8 @@
常用分类 常用分类
</view> </view>
<view class="types"> <view class="types">
<view class="types-li"> <view class="types-li" v-for="(item,index) in searchList" @click='hdChose(item)'>
地方大 {{item.label}}
</view>
<view class="types-li">
地方撒
</view>
<view class="types-li">
地方撒旦
</view>
<view class="types-li">
地方撒大苏
</view>
<view class="types-li">
地方
</view>
<view class="types-li">
地方撒大苏
</view> </view>
</view> </view>
@ -37,8 +22,6 @@
<view class="types-li" v-for="(item,index) in hotList" @click='hdChose(item)'> <view class="types-li" v-for="(item,index) in hotList" @click='hdChose(item)'>
{{item.label}} {{item.label}}
</view> </view>
</view> </view>
</view> </view>
@ -52,7 +35,6 @@
<view v-else style="text-align: center;margin-top: 50rpx;"> <view v-else style="text-align: center;margin-top: 50rpx;">
暂无搜索结果,点击 <text @click="navgo" style='color:#35BC3E;text-decoration: underline;'>手动选择</text> 暂无搜索结果,点击 <text @click="navgo" style='color:#35BC3E;text-decoration: underline;'>手动选择</text>
</view> </view>
</view> </view>
</view> </view>
@ -61,7 +43,8 @@
<script> <script>
import { import {
categorySearch, categorySearch,
categoryHotcate categoryHotcate,
categorySearchHistory,
} from '@/api/product.js' } from '@/api/product.js'
export default { export default {
data() { data() {
@ -86,6 +69,9 @@
}) })
}, },
hdChose(item) { hdChose(item) {
categorySearchHistory(this.mer_id, this.$store.state.app.userInfo.uid, {
cate_id: item.value
})
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}` url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}`
}) })
@ -93,9 +79,18 @@
}, },
onLoad(option) { onLoad(option) {
this.mer_id = option.mer_id this.mer_id = option.mer_id
categoryHotcate(option.mer_id).then(res => { categoryHotcate(
this.hotList = res.data.map(item => ({ option.mer_id,
this.$store.state.app.userInfo.uid
).then(res => {
this.hotList = res.data.hot_cate.map(item => ({
label: item.cate_name,
value: item.store_category_id
})
)
this.searchList = res.data.active_cate.map(item => ({
label: item.cate_name, label: item.cate_name,
value: item.store_category_id value: item.store_category_id