add
This commit is contained in:
parent
56921854dd
commit
9cb77a57e4
|
@ -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);
|
||||
}
|
|
@ -160,12 +160,21 @@ export function categorySearch(merId, data) {
|
|||
添加修改商品, 热门分类商品
|
||||
*/
|
||||
|
||||
export function categoryHotcate(merId, data) {
|
||||
return request.get(`server/${merId}/category/hotcate`, data, {
|
||||
export function categorySearchHistory(merId, uid, data) {
|
||||
return request.post(`server/${merId}/category/search_history/${uid}`, data, {
|
||||
login: true
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
添加修改商品, 添加热门分类商品
|
||||
*/
|
||||
|
||||
export function categoryHotcate(merId, uid) {
|
||||
return request.get(`server/${merId}/category/hotcate/${uid}`, {
|
||||
login: true
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
商品管理, 添加商品
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{value1.length}}/{{maxLength}}</text>
|
||||
</u-form-item>
|
||||
<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>
|
||||
</view>
|
||||
<view class="card" style="min-height: 268rpx;">
|
||||
|
@ -146,9 +146,8 @@
|
|||
],
|
||||
selfAttr: "",
|
||||
formData: {
|
||||
store_name: "",
|
||||
// store_name: "",
|
||||
imageList: [],
|
||||
attrValue: [],
|
||||
cate_name: "",
|
||||
cate_id: "",
|
||||
attrValue: [{
|
||||
|
@ -157,9 +156,12 @@
|
|||
"wholesale_unit_name": "",
|
||||
"wholesale_price": '',
|
||||
"stock": "",
|
||||
open: true,
|
||||
spec_type: '单规格'
|
||||
}],
|
||||
product_attribute: [],
|
||||
spec_type: "0"
|
||||
image: '',
|
||||
slider_image: [],
|
||||
// product_attribute: [],
|
||||
},
|
||||
showPouple: false,
|
||||
fileList6: [],
|
||||
|
@ -169,9 +171,6 @@
|
|||
value4: "",
|
||||
maxLength: 30,
|
||||
showSex: false,
|
||||
|
||||
|
||||
|
||||
rules: {
|
||||
title: {
|
||||
type: 'string',
|
||||
|
@ -264,9 +263,12 @@
|
|||
})
|
||||
},
|
||||
async submit() {
|
||||
// this.formData.imageList = this.formData.imageList.map(item => item.url)
|
||||
// await this.$refs.formData.validate()
|
||||
productCreate(this.mer_id, this.formData)
|
||||
let data = uni.$u.deepClone(this.formData)
|
||||
data.imageList = data.imageList.map(item => item.url)
|
||||
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 => {
|
||||
hideLoading();
|
||||
Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
|
||||
|
@ -292,12 +294,8 @@
|
|||
if (option.data) {
|
||||
this.formData.cate_name = JSON.parse(option.data).label
|
||||
this.formData.cate_id = JSON.parse(option.data).value
|
||||
console.log(option.data)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<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="value1" placeholder="建议描述产品品牌、名称、规格、口味"
|
||||
<u--textarea v-model="formData.store_name" placeholder="建议描述产品品牌、名称、规格、口味"
|
||||
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
|
||||
:maxlength='maxLength'></u--textarea>
|
||||
</u-form-item>
|
||||
|
@ -54,8 +54,10 @@
|
|||
</u-form-item>
|
||||
<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"
|
||||
@click="navgo('/pages/product/addGoodDetail/goodsAttr')">
|
||||
<view style="margin-right: 10rpx;line-height: 25rpx;">去设置</view>
|
||||
@click="navgo(`/pages/product/addGoodDetail/goodsAttr?attr=${JSON.stringify(formData.attribute) }`)">
|
||||
<view style="margin-right: 10rpx;line-height: 25rpx;">
|
||||
{{Object.values(formData.attribute).length ?"已设置":"未设置"}}
|
||||
</view>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
@ -63,14 +65,40 @@
|
|||
<view class='tips'>
|
||||
规格与价格
|
||||
</view>
|
||||
<view class="card" style="height: 100rpx;padding: 14rpx 30rpx;">
|
||||
<u-form-item label="规格与价格" prop="userInfo.name" ref="item1" labelPosition="left" required>
|
||||
<view class="card" style="min-height: 100rpx;padding: 14rpx 30rpx;">
|
||||
<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"
|
||||
@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>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</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 class='tips'>
|
||||
服务与承诺
|
||||
|
@ -85,9 +113,9 @@
|
|||
|
||||
<u-line color="#F3F3F3" style="margin: 30rpx 0;"></u-line>
|
||||
<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"
|
||||
:label="item.name" :name="item.name" activeColor="#20B128"
|
||||
:label="item.name" :name="item.value" activeColor="#20B128"
|
||||
:customStyle="{marginRight: '8px'}"
|
||||
:labelColor="checkboxValue1.includes(item.name)?'#20B128':'#777777'">
|
||||
</u-checkbox>
|
||||
|
@ -159,21 +187,9 @@
|
|||
"imageList": [
|
||||
|
||||
],
|
||||
"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": ""
|
||||
}],
|
||||
"attrValue": [
|
||||
|
||||
],
|
||||
"cate_name": "兽药",
|
||||
"unit_name": "件",
|
||||
"cate_id": 1826,
|
||||
|
@ -184,10 +200,7 @@
|
|||
"spec_type": "0",
|
||||
"attr": [],
|
||||
"specifica": "",
|
||||
"delivery_way": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"delivery_way": [],
|
||||
"delivery_free": "1",
|
||||
"temp_id": "",
|
||||
"tempName": "",
|
||||
|
@ -205,7 +218,8 @@
|
|||
"title": "",
|
||||
"image": []
|
||||
},
|
||||
"stock": "20"
|
||||
"stock": "20",
|
||||
attribute: {},
|
||||
},
|
||||
mer_id: "",
|
||||
maxLength: 30,
|
||||
|
@ -238,9 +252,11 @@
|
|||
checkboxValue1: [],
|
||||
checkboxList1: [{
|
||||
name: '到店核销',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: '快递配送',
|
||||
value: 2,
|
||||
},
|
||||
|
||||
],
|
||||
|
@ -356,18 +372,29 @@
|
|||
},
|
||||
submit() {
|
||||
console.log(this.formData)
|
||||
}
|
||||
|
||||
},
|
||||
getAttr(object) {
|
||||
this.formData.attribute = object
|
||||
},
|
||||
getAttrValue(object) {
|
||||
this.formData.attrValue = object
|
||||
console.log(this.formData.attrValue)
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
onLoad(option) {
|
||||
this.mer_id = option.mer_id
|
||||
if (option.typeData) {
|
||||
this.formData.cate_name = JSON.parse(option.typeData).label
|
||||
this.formData.cate_id = JSON.parse(option.typeData).value
|
||||
console.log(this.formData, 'option')
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<u--form :model="model1" :rules="rules" ref="uForm" labelPosition="left"
|
||||
:labelStyle="{fontSize:'32rpx',color:'#444444'}" labelWidth='120' borderBottom>
|
||||
<u--form :model="model1" ref="uForm" labelPosition="left" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
|
||||
labelWidth='120' borderBottom>
|
||||
|
||||
<view class="description">
|
||||
产品属性
|
||||
|
@ -9,8 +9,8 @@
|
|||
<view class="label-cls">
|
||||
<u-form-item label="产地" prop="userInfo.name" ref="item1">
|
||||
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
|
||||
@click="showPouple=true,popType='place'">
|
||||
<view style="margin-right: 10rpx;line-height: 25rpx;">请选择</view>
|
||||
@click="showPouple=true,popType='place',getLocation()">
|
||||
<view style="margin-right: 10rpx;line-height: 25rpx;">{{formData.address||'请选择'}}</view>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</u-form-item>
|
||||
|
@ -32,33 +32,34 @@
|
|||
</view>
|
||||
<view class="description" style="display: flex;justify-content: space-between;align-items: center">
|
||||
<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> 自定义
|
||||
</view>
|
||||
</view>
|
||||
<view class="label-cls"
|
||||
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;">
|
||||
<u--input placeholder="请填写属性名称" border="surround" v-model="item.label"></u--input>
|
||||
<u-line direction="col" length="40rpx" color="#CECECE"></u-line>
|
||||
<u--input placeholder="请填写属性值" border="surround" v-model="item.value"></u--input>
|
||||
<u-line direction="col" length="40rpx" color="#CECECE"></u-line>
|
||||
</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> 删除
|
||||
</view>
|
||||
</view>
|
||||
</u--form>
|
||||
<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>
|
||||
|
||||
|
||||
<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="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
|
||||
style="font-size:32rpx ;color:#333333 ;">{{popType=='place'?'商品产地': popType=='leval'?'商品等级':'商品包装' }}
|
||||
|
@ -82,11 +83,11 @@
|
|||
:style="{color:positionType==0?'#20B128':'#707070'} ">
|
||||
{{address.province||'请选择' }}
|
||||
</view>
|
||||
<view class="province-li" @click='positionType=1,positionList=cityList'
|
||||
<view class="province-li" @click='choseCity'
|
||||
:style="{color:positionType==1?'#20B128':'#707070'} ">
|
||||
{{address.city ||'请选择'}}
|
||||
</view>
|
||||
<view class="province-li" @click='positionType=2,positionList=districtList'
|
||||
<view class="province-li" @click='choseArea'
|
||||
:style="{color:positionType==2?'#20B128':'#707070'} ">
|
||||
{{address.district ||'请选择'}}
|
||||
</view>
|
||||
|
@ -97,12 +98,13 @@
|
|||
请选择
|
||||
</view>
|
||||
<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>
|
||||
{{item}}
|
||||
{{item.name}}
|
||||
</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>
|
||||
</view>
|
||||
|
||||
|
@ -164,71 +166,22 @@
|
|||
import {
|
||||
getGeocoder,
|
||||
} from '@/api/store.js';
|
||||
import {
|
||||
getProvince,
|
||||
getCity,
|
||||
getArea
|
||||
} from "@/api/common.js"
|
||||
import {
|
||||
formatDate
|
||||
} from '../../../libs/uniApi';
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
provinceList: [
|
||||
"北京市",
|
||||
"天津市",
|
||||
"河北省",
|
||||
"山西省",
|
||||
"内蒙古自治区",
|
||||
"辽宁省",
|
||||
"吉林省",
|
||||
"黑龙江省",
|
||||
"上海市",
|
||||
"江苏省",
|
||||
"浙江省",
|
||||
"安徽省",
|
||||
"福建省",
|
||||
"江西省",
|
||||
"山东省",
|
||||
"河南省",
|
||||
"湖北省",
|
||||
"湖南省",
|
||||
"广东省",
|
||||
"广西壮族自治区",
|
||||
"海南省",
|
||||
"重庆市",
|
||||
"四川省",
|
||||
"贵州省",
|
||||
"云南省",
|
||||
"西藏自治区",
|
||||
"陕西省",
|
||||
"甘肃省",
|
||||
"青海省",
|
||||
"宁夏回族自治区",
|
||||
"新疆维吾尔自治区",
|
||||
"台湾省",
|
||||
"香港特别行政区",
|
||||
"澳门特别行政区"
|
||||
],
|
||||
cityList: [
|
||||
"成都市",
|
||||
"自贡市",
|
||||
"攀枝花市",
|
||||
"泸州市",
|
||||
"德阳市",
|
||||
"绵阳市",
|
||||
"广元市",
|
||||
"遂宁市",
|
||||
"内江市",
|
||||
"乐山市",
|
||||
"南充市",
|
||||
"眉山市",
|
||||
"宜宾市",
|
||||
"广安市",
|
||||
"达州市",
|
||||
"雅安市",
|
||||
"巴中市",
|
||||
"资阳市",
|
||||
"阿坝藏族羌族自治州",
|
||||
"甘孜藏族自治州",
|
||||
"凉山彝族自治州"
|
||||
],
|
||||
districtList: ['江阳区', '牛马塔努', '需用唉', '泸县'],
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
districtList: [],
|
||||
positionList: [],
|
||||
areaList: [],
|
||||
districtList: [],
|
||||
|
@ -237,27 +190,27 @@
|
|||
},
|
||||
selfLeval: "",
|
||||
levalList: [
|
||||
"撒旦",
|
||||
"撒旦",
|
||||
"撒旦",
|
||||
"撒旦",
|
||||
|
||||
"优等品",
|
||||
"一等品",
|
||||
"合格品",
|
||||
],
|
||||
selfPack: "",
|
||||
packList: [
|
||||
"纸箱子",
|
||||
"纸箱子",
|
||||
"纸箱子",
|
||||
"盒装",
|
||||
"箱装",
|
||||
"袋装",
|
||||
"盆装",
|
||||
"泡沫箱"
|
||||
],
|
||||
address: {
|
||||
province: '',
|
||||
province_code: '',
|
||||
city: "",
|
||||
district: ""
|
||||
city_code: "",
|
||||
district: "",
|
||||
district_code: ""
|
||||
},
|
||||
attr: [{
|
||||
label: "",
|
||||
value: ''
|
||||
}],
|
||||
|
||||
show: false,
|
||||
popType: 'leval',
|
||||
showPouple: false,
|
||||
|
@ -265,8 +218,13 @@
|
|||
positionType: 0,
|
||||
|
||||
formData: {
|
||||
address: "",
|
||||
leval: "",
|
||||
pack: "",
|
||||
attr: [{
|
||||
label: "",
|
||||
value: ''
|
||||
}]
|
||||
},
|
||||
|
||||
model1: {
|
||||
|
@ -275,38 +233,11 @@
|
|||
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: {
|
||||
|
@ -321,7 +252,7 @@
|
|||
},
|
||||
confirm() {
|
||||
if (this.popType == 'place') {
|
||||
console.log('')
|
||||
this.formData.address = this.address.province + this.address.city + this.address.district
|
||||
} else if (this.popType == 'leval') {
|
||||
this.levalList.push(this.selfLeval)
|
||||
this.formData.leval = this.levalList[this.levalList.length - 1]
|
||||
|
@ -336,10 +267,45 @@
|
|||
this.showPouple = false
|
||||
},
|
||||
chosePosition(item) {
|
||||
this.address.province = item
|
||||
this.address.city = ''
|
||||
this.address.district = ''
|
||||
if (this.positionType == 0) {
|
||||
this.address.province = item.name
|
||||
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() {
|
||||
let that = this
|
||||
|
@ -352,9 +318,11 @@
|
|||
}).then(res1 => {
|
||||
that.address = res1.data.address_component
|
||||
that.positionList = that.provinceList
|
||||
// this.$store.commit('setLocation', res.data)
|
||||
// this.street = res.data.address_component.street
|
||||
console.log(that.address, 'res')
|
||||
that.provinceList.forEach(item => {
|
||||
if (that.address.province == item.name) {
|
||||
that.address.province_code = item.code
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
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() {
|
||||
this.getLocation()
|
||||
onLoad(option) {
|
||||
getProvince().then(res => {
|
||||
this.provinceList = res.data
|
||||
})
|
||||
if (Object.values(JSON.parse(option.attr)).length) {
|
||||
this.formData = JSON.parse(option.attr)
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -1,50 +1,67 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<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 class="card">
|
||||
<view class="card" v-for="(item,index) in attrValue">
|
||||
<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;">
|
||||
<u--input placeholder="请输入规格名称" v-model="text"></u--input>
|
||||
<u--input placeholder="请输入规格名称" v-model="item.spec_type"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<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="" style="flex: 1;text-align: center;">
|
||||
/
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
|
||||
v-model="text"></u--input>
|
||||
</view>
|
||||
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
||||
<view class=" card-li">
|
||||
<text style="font-size: 32rpx;">商品库存</text>
|
||||
<view class="" style="width: 200rpx;">
|
||||
<u--input placeholder="请填写库存数量" v-model="text"></u--input>
|
||||
<u--input placeholder="请填写库存数量" v-model="item.stock"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
||||
<view class=" card-li">
|
||||
<text style="font-size: 32rpx;">条形码</text>
|
||||
<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>
|
||||
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
||||
<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> 删除
|
||||
</view>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn">
|
||||
<u-button type="primary" shape="circle" text="保存" @click="submit"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -53,7 +70,42 @@
|
|||
data() {
|
||||
return {
|
||||
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;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
width: 670rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -9,23 +9,8 @@
|
|||
常用分类
|
||||
</view>
|
||||
<view class="types">
|
||||
<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 class="types-li">
|
||||
地方撒大苏
|
||||
<view class="types-li" v-for="(item,index) in searchList" @click='hdChose(item)'>
|
||||
{{item.label}}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
@ -37,8 +22,6 @@
|
|||
<view class="types-li" v-for="(item,index) in hotList" @click='hdChose(item)'>
|
||||
{{item.label}}
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
@ -52,7 +35,6 @@
|
|||
<view v-else style="text-align: center;margin-top: 50rpx;">
|
||||
暂无搜索结果,点击 <text @click="navgo" style='color:#35BC3E;text-decoration: underline;'>手动选择</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
@ -61,7 +43,8 @@
|
|||
<script>
|
||||
import {
|
||||
categorySearch,
|
||||
categoryHotcate
|
||||
categoryHotcate,
|
||||
categorySearchHistory,
|
||||
} from '@/api/product.js'
|
||||
export default {
|
||||
data() {
|
||||
|
@ -86,6 +69,9 @@
|
|||
})
|
||||
},
|
||||
hdChose(item) {
|
||||
categorySearchHistory(this.mer_id, this.$store.state.app.userInfo.uid, {
|
||||
cate_id: item.value
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}`
|
||||
})
|
||||
|
@ -93,9 +79,18 @@
|
|||
},
|
||||
onLoad(option) {
|
||||
this.mer_id = option.mer_id
|
||||
categoryHotcate(option.mer_id).then(res => {
|
||||
this.hotList = res.data.map(item => ({
|
||||
categoryHotcate(
|
||||
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,
|
||||
value: item.store_category_id
|
||||
|
||||
|
|
Loading…
Reference in New Issue