This commit is contained in:
zmj 2024-04-19 18:08:04 +08:00
parent 794beec9df
commit 336c7078bb
7 changed files with 730 additions and 211 deletions

View File

@ -147,6 +147,26 @@ export function categoryList(merId) {
})
}
/*
添加修改商品 搜索上平
*/
export function categorySearch(merId, data) {
return request.get(`server/${merId}/category/search`, data, {
login: true
})
}
/*
添加修改商品 热门分类商品
*/
export function categoryHotcate(merId, data) {
return request.get(`server/${merId}/category/hotcate`, data, {
login: true
})
}
/*
商品管理 添加商品
*/

View File

@ -1574,7 +1574,7 @@
{
"path": "addGoodDetail/goodsSearch",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "商品分类",
"enablePullDownRefresh": false
}
}

View File

@ -1,43 +1,103 @@
<template>
<view class='content'>
<u--form :model="model1" :rules="rules" ref="uForm" labelPosition="top"
:labelStyle="{fontWeight:'bold',fontSize:'32rpx'}" labelWidth='100'>
<u-form-item label="想卖什么" prop="userInfo.name" ref="item1"
@click="navgo('/pages/product/addGoodDetail/goodsSearch')">
<view class="borders">
<u--textarea v-model="model1.userInfo.name" placeholder="请描述您想卖的货品名称,如:红富士苹果、宁夏西瓜、梨。"></u--textarea>
<u--form :model="formData" :rules="rules" ref="formData" :labelStyle="{fontSize:'32rpx'}" labelWidth='auto'>
<view class="card" style="height: 300rpx;"
@click="navgo(`/pages/product/addGoodDetail/goodsSearch?mer_id=${mer_id}`)">
<u-form-item label="想卖什么" prop="title">
<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'
:maxlength='maxLength'></u--textarea>
</view>
<view class="card" style="min-height: 268rpx;">
<u-form-item label="商品图片" prop="userInfo.name" ref="item1" labelWidth='auto'>
<text style="font-size:24rpx ; color:#E18C34 ;">上传时应注重真实性清晰度</text>
</u-form-item>
<view class="" style="display: flex;flex-wrap: wrap;">
<u-upload :fileList="formData.imageList" @afterRead="afterRead" @delete="deletePic" name="6"
multiple :maxCount="5">
<view class='uploadimg'>
<u-icon name="plus" color="#777777"></u-icon>
<view class="" style="color: #777777;font-size: 24rpx;">
上传图片
</view>
</view>
</u-upload>
</view>
</u-form-item>
<u-form-item label="上传商品图" prop="userInfo.name" ref="item1">
<uploadImgVideo></uploadImgVideo>
</u-form-item>
<u-form-item label="商品售价" prop="userInfo.name" ref="item1">
<view class="borders" style="width:250rpx;height: 100rpx;">
<u--input placeholder="" v-model="text"></u--input>
</view>
<text style="margin: 0 20rpx;"></text>
<uni-section type="line" style="width:250rpx;">
<uni-data-select v-model="text" :localdata="range" placeholder=""></uni-data-select>
</uni-section>
</u-form-item>
</view>
<view class="card">
<u-form-item label="规格与价格" prop="userInfo.name" ref="item1" border-bottom>
</u-form-item>
<u-form-item label="计量单位" prop="userInfo.name" ref="item1" border-bottom>
<view style="display: flex;" slot='right' @click='showPouple=true'>
<view style="margin-right: 10rpx;line-height: 25rpx;color:#777777">
{{formData.attrValue[0].unit_name ||'请选择'}}
</view>
<u-icon name="arrow-right" style="margin-right: 30rpx;"></u-icon>
</view>
</u-form-item>
<u-form-item label="零售价格" prop="userInfo.name" ref="item1" border-bottom>
<u--input placeholderStyle="color:#777777" style="width: 220rpx;" placeholder="请输入零售价"
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 placeholderStyle="color:#777777" style="width: 250rpx;" placeholder="请输入批发价格"
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 placeholderStyle="color:#777777" style="width: 220rpx;" placeholder="请输入零售价"
v-model="formData.attrValue[0].stock" slot='right'></u--input>
</u-form-item>
</view>
<view class="footer">
<view class="footer-top" @click='goDetail'>
<text style="margin: 0 auto;">
<text style="margin: 10rpx auto;">
显示全部<u-icon style="display: inline-block;font-weight: bold;" color="$uni-newTheme-color"
name="arrow-right"></u-icon>
</text>
</view>
<view class="footer-bottom">
发布内容越详尽成单力越高
发布内容越详尽成单力越高~
</view>
</view>
<view class="submit-btn">
<u-button text="立即发布获取订单" :class="{height:'200px'}" color="#33BB3C"></u-button>
<view class="submit-btn" @click='submit'>
<u-button text="立即发布获取订单" color="#33BB3C" class="custom-style"></u-button>
</view>
</u--form>
<u-popup :show="showPouple" @close="showPouple=false" @open="showPouple=true" :round="10">
<view class="RegularFont" style="padding: 42rpx 40rpx">
<view class="pop-head">
<text v-if='!showCustom' @click='showPouple=false'>取消</text>
<text v-else @click='showCustom=false'>
<u-icon name="arrow-left" size="20"></u-icon>
</text>
<text style="font-size:32rpx ;color:#333333 ;">计量单位</text>
<text v-if='showCustom' @click='addAttr'>确定</text>
<text v-else></text>
</view>
<view style="height: 500rpx;">
<u-transition :show="!showCustom" mode="slide-right">
<view class="goods-leval">
<view class="goods-leval-li" v-for='(item,index) in attrList' :key='index'
@click='choseAttr(item)'>
{{item}}
</view>
<view class="goods-leval-li " style="display: flex;color:#38BE41 ;"
@click="showCustom=true">
<u-icon name="plus" color="#38BE41" style='margin-right: 8rpx;'></u-icon>
</view>
</view>
</u-transition>
<u-transition :show="showCustom" mode="slide-left">
<view class="transition">
<u--textarea v-model="selfAttr" placeholder="请输入计量单位"></u--textarea>
</view>
</u-transition>
</view>
</view>
</u-popup>
</view>
@ -46,36 +106,79 @@
</template>
<script>
import form from "../../../uni_modules/uview-ui/libs/config/props/form";
import {
productCreate,
productUpdate
} from '@/api/product.js';
import uploadImgVideo from "./components/uploadImgVideo.vue"
import {
TOKENNAME,
HTTP_REQUEST_URL
} from '@/config/app.js';
import {
formatDate
} from "../../../libs/uniApi";
export default {
components: {
uploadImgVideo,
},
data() {
return {
showSex: false,
model1: {
userInfo: {
name: '',
sex: '',
},
},
range: [{
value: 0,
text: "篮球"
},
{
value: 1,
text: "足球"
},
{
value: 2,
text: "游泳"
},
isWholeSale: false, //
show: false, //
showCustom: false, //
mer_id: "",
attrList: ['斤',
"公斤",
"吨",
"升",
"个",
"台",
"瓶",
"桶",
"箱",
"袋",
"包",
"盒",
"件",
"罐"
],
text: "",
selfAttr: "",
formData: {
store_name: "",
imageList: [],
attrValue: [],
cate_name: "",
cate_id: "",
attrValue: [{
"price": "",
"unit_name": "",
"wholesale_unit_name": "",
"wholesale_price": '',
"stock": "",
}],
product_attribute: [],
spec_type: "0"
},
showPouple: false,
fileList6: [],
value1: "",
value2: "",
value3: "",
value4: "",
maxLength: 30,
showSex: false,
rules: {
title: {
type: 'string',
required: true,
message: '请选择',
trigger: ['blur', 'change']
}
// 'userInfo.name': {
// type: 'string',
// required: true,
@ -90,57 +193,153 @@
// trigger: ['blur', 'change']
// },
},
radio: '',
switchVal: false
};
},
methods: {
sexSelect(e) {
this.model1.userInfo.sex = e.name
this.$refs.uForm.validateField('userInfo.sex')
//
deletePic(event) {
this.formData[`imageList`].splice(event.index, 1)
},
//
async afterRead(event) {
// multiple true , file
let lists = [].concat(event.file)
let fileListLen = this.formData[`imageList`].length
lists.map((item) => {
this.formData[`imageList`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this.formData[`imageList`][fileListLen]
this.formData[`imageList`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: HTTP_REQUEST_URL + '/api/upload/image/field',
filePath: url,
name: 'field',
success: (res) => {
console.log(res.data)
resolve(JSON.parse(res.data).data.path)
}
});
})
},
choseAttr(name) {
this.formData.attrValue[0].unit_name = name;
this.formData.attrValue[0].wholesale_unit_name = name;
this.showPouple = false
},
addAttr() {
if (!this.selfAttr) return;
this.attrList.push(this.selfAttr)
this.formData.attrValue[0].unit_name = this.attrList[this.attrList.length - 1]
this.formData.attrValue[0].wholesale_unit_name = this.attrList[this.attrList.length - 1]
this.selfAttr = ''
this.showCustom = false
this.showPouple = false
},
goDetail() {
uni.navigateTo({
url: '/pages/product/addGoodDetail/addGoodDetail'
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&formData=${JSON.stringify(this.formData)}`
})
},
navgo(url) {
uni.navigateTo({
url
})
},
async submit() {
this.formData.imageList = this.formData.imageList.map(item => item.url)
console.log(this.formData)
// await this.$refs.formData.validate()
productCreate(this.mer_id, this.formData)
.then(res => {
hideLoading();
Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
if (this.import == 1) {
uni.$emit('importAttrValueOK', this.setFormData.import_id);
uni.navigateBack();
} else uni.redirectTo({
url: `/pages/product/goodsOnSale/index?mer_id=${this.mer_id}&type=6`
})
}).catch(() => {
uni.navigateBack()
})
})
.catch(rej => {
Toast(rej);
});
console.log(this.formData)
}
},
onLoad(option) {
this.mer_id = option.mer_id
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
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'>
@font-face {
font-family: PingFangFamily;
src: url('/static/font/PingFangMedium.ttf');
}
.content {
width: 100vw;
min-height: 100vh;
background-color: white;
background-color: #F1F1F1;
box-sizing: border-box;
padding: 30rpx;
font-family: PingFangFamily;
padding: 20rpx;
padding-bottom: 200rpx;
font-family: PingFangRegular;
.borders {
width: 690rpx;
border: 1px solid #CECECE;
border-radius: 10rpx;
}
}
.card {
background-color: white;
padding: 28rpx 30rpx;
border-radius: 12rpx;
margin-bottom: 30rpx;
}
.uploadimg {
width: 140rpx;
height: 140rpx;
border-radius: 16rpx;
border: 2rpx solid #F1F1F1;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
box-sizing: border-box;
padding: 20rpx 0;
}
.footer {
position: absolute;
bottom: 270rpx;
left: 50%;
transform: translate(-50%, 0);
font-size: 28rpx;
margin-top: 130rpx;
text-align: center;
.footer-top {
color: $uni-newTheme-color;
@ -157,18 +356,43 @@
}
.pop-head {
display: flex;
justify-content: space-between;
color: #20B128;
margin-bottom: 42rpx;
}
.goods-leval {
display: flex;
flex-wrap: wrap;
overflow-y: auto;
.goods-leval-li {
margin-right: 20rpx;
padding: 10rpx 40rpx;
height: 60rpx;
margin-bottom: 20rpx;
border-radius: 36rpx 36rpx 36rpx 36rpx;
background-color: #F1F1F1;
}
.act {
color: #20B128;
background-color: #E8F7E9;
border: 1px solid #20B128;
}
}
.submit-btn {
position: absolute;
bottom: 86rpx;
position: fixed;
bottom: 50rpx;
left: 50%;
transform: translate(-50%, 0);
width: 670rpx;
border-radius: 40rpx;
overflow: hidden;
}
/deep/ .uni-select {
height: 100rpx;
border: 2rpx #CECECE solid;
}
</style>

View File

@ -1,40 +1,53 @@
<template>
<view class='content'>
<u--form :model="model1" :rules="rules" ref="uForm" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
labelWidth='auto'>
<view class="good-baseInfo card">
<u-form-item label="商品标题" prop="userInfo.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="value1" placeholder="建议描述产品品牌、名称、规格、口味"
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
:maxlength='maxLength'></u--textarea>
</u-form-item>
<u--form :model="model1" :rules="rules" ref="uForm" labelPosition="top"
:labelStyle="{fontSize:'32rpx',color:'#444444'}" labelWidth='120'>
<view class="good-baseInfo">
<u-form-item label="商品标题" prop="userInfo.name" ref="item1">
<u--input placeholder="建议描述产品品牌、名称" v-model="text"></u--input>
<u-form-item label="商品主图" prop="userInfo.name" ref="item1" required>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度</text>
</u-form-item>
<u-form-item class='formItem' label="商品主图" prop="userInfo.name" ref="item1">
<view class="">
<view style="color: #E18C34;font-size: 24rpx;margin-bottom: 30rpx;">
上传时应注重真实性清晰度
<u-form-item prop="userInfo.name" ref="item1">
<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6" multiple
:maxCount="5">
<view class='uploadimg'>
<u-icon name="plus" color="#777777"></u-icon>
<view class="" style="color: #777777;font-size: 24rpx;">
上传图片
</view>
</view>
<view class="">
<uploadImgVideo />
</view>
</view>
</u-upload>
</u-form-item>
<u-form-item label="商品细节图" prop="userInfo.name" ref="item1">
<view class="">
<view style="color: #E18C34;font-size: 24rpx;margin-bottom: 30rpx;">
请上传突出商品卖点细节图片
<u-form-item label="商品详情" prop="userInfo.name" ref="item1" required>
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性清晰度</text>
</u-form-item>
<u-form-item prop="userInfo.name" ref="item1">
<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6" multiple
:maxCount="5">
<view class='uploadimg'>
<u-icon name="plus" color="#777777"></u-icon>
<view class="" style="color: #777777;font-size: 24rpx;">
上传图片
</view>
</view>
<view class="">
<uploadImgVideo />
</view>
</view>
</u-upload>
</u-form-item>
</view>
<view class='tips'>
商品图片上传时应注重真实性清晰度和美观性在平台上的展示效果至关重要确保商品能够得到有效的展示和推广
商品类目属性
</view>
<view class="label-cls">
<u-form-item label="商品分类" prop="userInfo.name" ref="item1" labelPosition="left">
<view class="card" style="padding: 14rpx 30rpx;">
<u-form-item label="商品分类" prop="userInfo.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')">
@click="navgo(`/pages/product/addGoodDetail/goodsType?mer_id=${mer_id}`)">
<view style="margin-right: 10rpx;line-height: 25rpx;">请选择</view>
<u-icon name="arrow-right"></u-icon>
</view>
@ -47,28 +60,31 @@
</view>
</u-form-item>
</view>
<view class="description">
<view class='tips'>
规格与价格
</view>
<view class="label-cls">
<u-form-item label="规格与价格" prop="userInfo.name" ref="item1" labelPosition="left">
<view class="card" style="height: 100rpx;padding: 14rpx 30rpx;">
<u-form-item label="规格与价格" prop="userInfo.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/goodsPrice')">
<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>
</view>
</u-form-item>
</view>
<view class="description">
<view class='tips'>
服务与承诺
</view>
<view class="label-cls">
<u-form-item label="商品详细描述" prop="userInfo.name" ref="item1">
<u--textarea v-model="value1" placeholder="货品描述请严格遵循广告法规定避免出
现虚假宣传和误导消费者的词语" count border="bottom" style="background-color:#F1F1F1;border-radius: 20rpx;"></u--textarea>
<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>
</u-form-item>
<u-line color="#F3F3F3"></u-line>
<u-form-item label="送货方式" labelPosition="left">
<u--textarea v-model="value1" placeholder="货品描述请严格遵循《广告法》规定,避免出现虚假宣传和误导消费者的词语"
style="background-color: #F9F9F9;height: 166rpx;" :autoHeight='true'
:maxlength='maxLength'></u--textarea>
<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 shape="circle" v-for="(item, index) in checkboxList1" :key="index"
:label="item.name" :name="item.name" activeColor="#20B128"
@ -79,14 +95,54 @@
</u-form-item>
</view>
</u--form>
<view class="submit-btn">
<u-button type="primary" shape="circle" text="确认发布"></u-button>
<u-button text="确认发布" color="#33BB3C" class="custom-style"></u-button>
</view>
<view class="overlay">
<u-overlay :show="showlay">
<view class="overlay-content">
<view class="">
温馨提示
</view>
<view class="" style="font-family: PingFangFamily;font-size: 36rpx;">
发布中断可能导致商机流失
</view>
<view class="" style="font-size: 26rpx;color: #777777;">
<view class="">
您的商品信息已经填写了大半
</view>
<view class="">
只差最后几步就能上架销售了
</view>
</view>
<view class=""
style="font-size: 28rpx;color: #444444;background-color: #EDF8ED;padding: 20rpx 44rpx;border-radius: 12rpx;">
<view class="">
越早发布产品<text style='color: #21B129;'>曝光量越高</text>
</view>
<view class="">
越早发布产品可提前 <text style='color: #21B129;'>抢占商机</text>
</view>
</view>
<view style="display: flex;">
<view style="width: 236rpx;height: 84rpx;margin-right: 30rpx;">
<u-button text="确定返回" @click='back'></u-button>
</view>
<view style="width: 236rpx;height: 84rpx;">
<u-button type='primary' text="继续编辑" @click='showlay=false'></u-button>
</view>
</view>
</view>
</u-overlay>
</view>
</view>
</template>
<script>
import {
HTTP_REQUEST_URL
} from '@/config/app.js';
import uploadImgVideo from "../addGood/components/uploadImgVideo.vue"
export default {
components: {
@ -94,7 +150,68 @@
},
data() {
return {
formData: {
"store_name": "测试商品",
"imageList": [
"https://crmeb-test.shop.lihaink.cn/uploads/def/20240419/a09b7188e9ef408a3f96d82b2b178082.jpeg",
"https://crmeb-test.shop.lihaink.cn/uploads/def/20240419/7a6d14dc327f6b0936e479891c0d253a.jpg"
],
"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": "兽药",
"unit_name": "件",
"cate_id": 1826,
"mer_cate_id": [
2331
],
"mer_cate_name": "测试",
"spec_type": "0",
"attr": [],
"specifica": "",
"delivery_way": [
1,
2
],
"delivery_free": "1",
"temp_id": "",
"tempName": "",
"once_min_count": "",
"image": "https://crmeb-test.shop.lihaink.cn/uploads/def/20240419/a09b7188e9ef408a3f96d82b2b178082.jpeg",
"slider_image": [
"https://crmeb-test.shop.lihaink.cn/uploads/def/20240419/7a6d14dc327f6b0936e479891c0d253a.jpg"
],
"is_good": 0,
"is_gift_bag": 0,
"sort": "",
"once_count": "",
"video_link": "",
"content": {
"title": "",
"image": [
"https://crmeb-test.shop.lihaink.cn/uploads/def/20240419/6f96b50e17bbf9a1289f82f620747b73.jpeg"
]
},
"stock": "20"
},
mer_id: "",
maxLength: 30,
fileList6: [],
showSex: false,
showlay: false,
go: true,
model1: {
userInfo: {
name: '',
@ -127,25 +244,56 @@
],
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: {
//
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
//
async afterRead(event) {
// multiple true , file
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: HTTP_REQUEST_URL + '/api/upload/image/field',
filePath: url,
name: 'field',
success: (res) => {
setTimeout(() => {
resolve(res.data.data)
}, 1000)
}
});
})
},
sexSelect(e) {
this.model1.userInfo.sex = e.name
this.$refs.uForm.validateField('userInfo.sex')
@ -154,10 +302,28 @@
uni.navigateTo({
url
})
},
back() {
// console.log('show')
this.go = false
uni.navigateBack()
},
showlayFn() {
uni.navigateBack()
}
},
onLoad(option) {
this.mer_id = option.mer_id
if (option.typeData) {
console.log(option, 'option')
}
},
onBackPress: function(e) {
this.showlay = true
return this.go;
}
};
</script>
@ -168,44 +334,66 @@
background-color: #F1F1F1;
box-sizing: border-box;
padding-bottom: 280rpx;
font-family: PingFangFamily;
font-family: PingFangRegular;
padding: 20rpx 20rpx 200rpx 20rpx;
.good-baseInfo {
.card {
background-color: white;
padding: 30rpx 30rpx 10rpx 30rpx;
}
.tips {
color: #E18C34;
font-size: 24rpx;
background-color: #FFF1E9;
padding: 26rpx 30rpx;
padding: 28rpx 30rpx;
border-radius: 12rpx;
margin-bottom: 30rpx;
}
.label-cls {
background-color: white;
padding: 8rpx 30rpx;
.uploadimg {
width: 140rpx;
height: 140rpx;
border-radius: 16rpx;
border: 2rpx solid #F1F1F1;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
box-sizing: border-box;
padding: 20rpx 0;
}
.description {
background-color: #F1F1F1;
padding: 30rpx 26rpx;
font-size: 28rpx;
.tips {
color: #777777;
font-size: 28rpx;
margin: 30rpx 0;
}
.submit-btn {
position: fixed;
bottom: 86rpx;
width: 750rpx;
padding: 20rpx 30rpx;
background-color: white;
z-index: 10;
box-shadow: 0 0 0.2px rgba(0, 0, 0, 0.3);
bottom: 50rpx;
left: 50%;
transform: translate(-50%, 0);
width: 670rpx;
border-radius: 40rpx;
overflow: hidden;
}
}
.overlay-content {
width: 570rpx;
height: 640rpx;
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 16rpx;
background-image: url('/static/images/addGodd/addGoodBg.png');
background-size: 100% 100%;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 70rpx 0 40rpx 0;
}
</style>

View File

@ -1,11 +1,12 @@
<template>
<view class="content">
<u-button icon="plus" text="新增规格" class="custom-style" iconColor='#38BE41'></u-button>
<view class="">
<u-button icon="plus" text="新增规格" class="custom-style" iconColor='#38BE41'></u-button>
</view>
<view class="card">
<view class="card-head card-li">
<text>规格1</text>
<view class="" style="width: 300rpx;">
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格1</text>
<view class="" style="width: 200rpx;">
<u--input placeholder="请输入规格名称" v-model="text"></u--input>
</view>
</view>
@ -18,28 +19,28 @@
<u--input style=" flex: 2;width:100rpx;background-color: #F6F6F6;" placeholder="请输入计量单位"
v-model="text"></u--input>
</view>
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class=" card-li">
<text>商品库存</text>
<view class="" style="width: 300rpx;">
<text style="font-size: 32rpx;">商品库存</text>
<view class="" style="width: 200rpx;">
<u--input placeholder="请填写库存数量" v-model="text"></u--input>
</view>
</view>
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class=" card-li">
<text>条形码</text>
<view class="" style="width: 300rpx;">
<text style="font-size: 32rpx;">条形码</text>
<view class="" style="width: 200rpx;">
<u--input placeholder="请填写商品条形码" v-model="text"></u--input>
</view>
</view>
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
<view class="card-li">
<view style="display: flex;">
<view style="display: flex;color: #777777;">
<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"></u-switch>
<text style="margin-left: 8rpx;">启用</text>
<u-switch v-model="value" type='primaryy' activeColor="#38BE41" size="19"></u-switch>
<text style="margin-left: 8rpx;color: #777777;">启用</text>
</view>
</view>
</view>
@ -72,7 +73,9 @@
min-height: 100vh;
position: relative;
font-size: 28rpx;
font-family: PingFangFamily;
font-family: PingFangRegular;
/* font-family: PingFangFamily; */
.card {
margin-top: 30rpx;

View File

@ -1,7 +1,8 @@
<template>
<view class="content">
<view class="" style="padding: 30rpx;">
<u-search v-model="keyword" :showAction="true" actionText="搜索" :animation="true"></u-search>
<u-search v-model="keyword" :showAction="true" actionText="搜索" :animation="true"
@change="hdChange"></u-search>
</view>
<view class="" v-if='!keyword' style="padding-left: 44rpx;">
<view style="margin: 60rpx 0 30rpx 14rpx;">
@ -33,44 +34,76 @@
热门分类
</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 hotList" @click='hdChose(item)'>
{{item.label}}
</view>
</view>
</view>
<view class="" v-else style="margin: 10rpx 0 0 30rpx;">
<view class="keyword-li" v-for='item in 10'>
元神--启动
<u-line direction="row" color="#ECECEC"></u-line>
<view class="" v-if='searchList.length'>
<view class="keyword-li" v-for='item in searchList' @click='hdChose(item)'>
{{item.label}}
<u-line direction="row" color="#ECECEC"></u-line>
</view>
</view>
<view v-else style="text-align: center;margin-top: 50rpx;">
暂无搜索结果,点击 <text @click="navgo" style='color:#35BC3E;text-decoration: underline;'>手动选择</text>
</view>
</view>
</view>
</template>
<script>
import {
categorySearch,
categoryHotcate
} from '@/api/product.js'
export default {
data() {
return {
keyword: ""
keyword: "",
mer_id: "",
searchList: [],
hotList: []
}
},
methods: {
hdChange() {
categorySearch(this.mer_id, {
keyword: this.keyword
}).then(res => {
this.searchList = res.data
})
},
navgo() {
uni.navigateTo({
url: `/pages/product/addGoodDetail/goodsType?mer_id=${this.mer_id}&&type=simple`
})
},
hdChose(item) {
uni.navigateTo({
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}`
})
}
},
onLoad(option) {
this.mer_id = option.mer_id
categoryHotcate(option.mer_id).then(res => {
this.hotList = res.data.map(item => ({
label: item.cate_name,
value: item.store_category_id
})
)
})
}
}
</script>
@ -90,7 +123,7 @@
min-height: 100vh;
position: relative;
font-size: 28rpx;
font-family: PingFangFamily;
font-family: PingFangRegular;
.types {
display: flex;

View File

@ -1,43 +1,93 @@
<template>
<view class="content">
<view class="lines" :style="{top:(actIndex*82)+30+'rpx'}" />
<view class="left">
<view class="left-li" v-for="(item,index) in 100" :class="actIndex==index?'act-li':''"
@click="actIndex=index">
常用分类
</view>
<view class="">
<view class="" style="padding: 30rpx;font-size: 28rpx;color: #989898;font-family: PingFangRegular;">
<text>当前已选</text>
<text style="margin-left: 48rpx;color: #20B128;">生鲜--水果阿萨</text>
</view>
<view class="">
<u-line direction="col" color="#ECECEC"></u-line>
</view>
<view class="right">
<u-search :showAction="true" v-model="keyword" actionText="搜索" :animation="true"></u-search>
<view style="margin: 30rpx 0;font-size: 28rpx; color: #989898;">
可能在找
</view>
<view class="right-content">
<view class="right-content-li" v-for='item in 20'>
可能在找
<view class="content">
<view class="lines" :style="{top:(actIndex*82)+30+'rpx'}" />
<view class="left">
<view class="left-li" v-for="(item,index) in leftList" :class="actIndex==index?'act-li':''"
@click="hdClcik(index)">
{{item.label}}
</view>
</view>
<view class="">
<u-line direction="col" color="#ECECEC"></u-line>
</view>
<view class="right">
<u-search :showAction="true" v-model="keyword" actionText="搜索" :animation="true"
@search='hdSearch'></u-search>
<view style="margin: 30rpx 0;font-size: 28rpx; color: #989898;">
可能在找
</view>
<view class="right-content">
<view class="right-content-li" v-for="(item,index) in rightList" @click="choseType(item)">
{{item.label}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
categoryList,
categorySearch
} from '@/api/product.js'
export default {
data() {
return {
mer_id: "",
keyword: "",
actIndex: 0,
leftList: [],
rightList: []
};
},
methods: {
hdClcik(index) {
this.actIndex = index
this.rightList = this.leftList[index].children
},
choseType(item) {
uni.navigateTo({
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&typeData=${JSON.stringify(item)} `
})
},
hdSearch() {
categorySearch(this.mer_id, {
keyword: this.keyword
}).then(res => {
this.rightList = res.data
console.log(res)
})
// categorySearch(this.mer_id) {
// }
}
},
onLoad(option) {
this.mer_id = option.mer_id
categoryList(option.mer_id).then((res) => {
this.leftList = res.data
this.rightList = res.data[0].children
}).catch(e => {
console.log(e);
})
}
};
</script>
@ -50,7 +100,7 @@
background-color: white;
min-height: 100vh;
position: relative;
font-family: PingFangFamily;
font-family: PingFangRegular;
.lines {
height: 38rpx;
@ -90,10 +140,11 @@
.right-content {
display: flex;
justify-content: space-around;
/* justify-content: space-around; */
flex-wrap: wrap;
.right-content-li {
margin-right: 20rpx;
color: #444444;
font-size: 28rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;