发布商品
This commit is contained in:
parent
12acca43be
commit
9802fda53a
|
@ -26,7 +26,7 @@
|
|||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<img src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/3/video_bg.png"
|
||||
style=" width:150rpx"></img>
|
||||
style=" width:140rpx"></img>
|
||||
<!--#endif-->
|
||||
<image src="@/static/images/gban.png" mode="widthFix"></image>
|
||||
</view>
|
||||
|
@ -39,9 +39,11 @@
|
|||
</view>
|
||||
<view class="" style="position: relative;" v-else>
|
||||
<view class="jiao" @click="formData.imageList.splice(index,1)">
|
||||
<image src="@/static/images/gban.png" mode="widthFix"></image>
|
||||
<image src="@/static/images/gban.png" mode="widthFix">
|
||||
</image>
|
||||
</view>
|
||||
<u--image :src="item" :fade="true" duration="450" width='140rpx' height='140rpx'></u--image>
|
||||
<u--image @click="preViewImg(item,index)" :src="item" :fade="true" duration="450"
|
||||
width='140rpx' height='140rpx'></u--image>
|
||||
</view>
|
||||
</view>
|
||||
<view class='uploadimg' @click="show=true">
|
||||
|
@ -206,8 +208,7 @@
|
|||
"volume": "",
|
||||
"extension_one": "",
|
||||
"extension_two": "",
|
||||
open: true,
|
||||
spec_type: ""
|
||||
"is_use": 0,
|
||||
}],
|
||||
"cate_name": "",
|
||||
"unit_name": "",
|
||||
|
@ -217,7 +218,10 @@
|
|||
],
|
||||
"mer_cate_name": "",
|
||||
"spec_type": "0",
|
||||
"attr": [],
|
||||
attr: [{
|
||||
detail: [],
|
||||
value: ""
|
||||
}, ],
|
||||
"specifica": "",
|
||||
"delivery_way": [
|
||||
|
||||
|
@ -239,7 +243,16 @@
|
|||
"title": "",
|
||||
"image": []
|
||||
},
|
||||
"stock": ""
|
||||
"stock": "",
|
||||
product_attribute: {
|
||||
address: "",
|
||||
leval: "",
|
||||
pack: "",
|
||||
attr: [{
|
||||
label: "",
|
||||
value: ''
|
||||
}]
|
||||
}
|
||||
},
|
||||
showPouple: false,
|
||||
fileList6: [],
|
||||
|
@ -299,8 +312,10 @@
|
|||
// 选择图片
|
||||
handleChooseImage() {
|
||||
let that = this;
|
||||
that.$util.uploadImageOne('upload/image', function(res) {
|
||||
console.log(that.formData)
|
||||
that.$util.uploadImages({
|
||||
count: 6,
|
||||
url: 'upload/image'
|
||||
}, function(res) {
|
||||
that.formData.imageList.push(res.data.path);
|
||||
});
|
||||
},
|
||||
|
@ -309,6 +324,7 @@
|
|||
let that = this
|
||||
uni.chooseVideo({
|
||||
sourceType: ['camera', 'album'],
|
||||
limit: 6,
|
||||
success: res => {
|
||||
uni.showLoading({
|
||||
title: '正在上传中。。。'
|
||||
|
@ -377,7 +393,7 @@
|
|||
},
|
||||
|
||||
goDetail() {
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&formData=${JSON.stringify(this.formData)}&&showSet=${false}`
|
||||
})
|
||||
},
|
||||
|
@ -386,6 +402,22 @@
|
|||
url
|
||||
})
|
||||
},
|
||||
preViewImg(url, index) {
|
||||
let that = this
|
||||
uni.previewImage({
|
||||
urls: [url],
|
||||
// longPressActions: {
|
||||
// itemList: ['发送给朋友', '保存图片', '收藏'],
|
||||
// success: function(data) {
|
||||
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
||||
// },
|
||||
// fail: function(err) {
|
||||
// console.log(err.errMsg);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
},
|
||||
async submit() {
|
||||
let data = uni.$u.deepClone(this.formData)
|
||||
data.image = data.imageList[0]
|
||||
|
@ -411,7 +443,6 @@
|
|||
.catch(rej => {
|
||||
// Toast(rej);
|
||||
});
|
||||
console.log(this.formData)
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
|
|
|
@ -139,33 +139,50 @@
|
|||
</u-form-item>
|
||||
|
||||
<view class="" v-if="showSet">
|
||||
<view class="" v-for="(item,index) in formData.attrValue.filter(item=> !item.is_use)">
|
||||
<u-form-item :label="item.spec_type" label-width="350rpx" prop="userInfo.name" ref="item1"
|
||||
labelPosition="left" border-bottom>
|
||||
<view class="" v-for="(item,index) in formData.attrValue.filter(item=> item.is_use==0)">
|
||||
<view class="" v-if='formData.attrValue.filter(item=> item.is_use==0).length==1'>
|
||||
<u-line color="#CECECE" style="margin-bottom: 30rpx;"></u-line>
|
||||
<view class="" style="display: flex;justify-content: space-around;">
|
||||
<view class=""
|
||||
style="display: flex;justify-content: space-around;flex: 1;border-right: 1px solid #CECECE;">
|
||||
<text>零售价格</text>
|
||||
<text>5000元/斤</text>
|
||||
</view>
|
||||
<view class="" style="display: flex;justify-content: space-around;flex: 1;">
|
||||
<text>商品库存</text>
|
||||
<text>5000</text>
|
||||
</view>
|
||||
|
||||
<view class="" style="display: flex;justify-content: space-between;width: 100%">
|
||||
<view style="width: 250rpx;" v-if='!item.spec_type'>
|
||||
|
||||
</view>
|
||||
<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 v-if='isWholeSale'>
|
||||
<view class="" style="display: flex;justify-content: space-between;width: 100%">
|
||||
<view style="font-size: 28rpx;color:#777777 ;">
|
||||
批发价
|
||||
</view>
|
||||
<view class="" v-else>
|
||||
<u-form-item :label="formData.attr[index].value" 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="width: 250rpx;" v-if='!formData.attr[index].value'>
|
||||
</view>
|
||||
<view style="font-size: 28rpx;color:#777777 ;">
|
||||
零售价
|
||||
</view>
|
||||
<view style="font-size: 28rpx;color:#777777 ;">
|
||||
{{item.price}}元/{{item.unit_name}}
|
||||
</view>
|
||||
</view>
|
||||
<view style="font-size: 28rpx;color:#777777 ;">
|
||||
{{item.wholesale_price}}元/{{item.wholesale_unit_name}}
|
||||
</u-form-item>
|
||||
<u-form-item label=" " label-width="350rpx" prop="userInfo.name" ref="item1"
|
||||
labelPosition="left" border-bottom v-if='isWholeSale'>
|
||||
<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.wholesale_price}}元/{{item.wholesale_unit_name}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-form-item>
|
||||
</u-form-item>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -308,7 +325,7 @@
|
|||
"volume": "",
|
||||
"extension_one": "",
|
||||
"extension_two": "",
|
||||
"open": true,
|
||||
"is_use": 0,
|
||||
"spec_type": ""
|
||||
}],
|
||||
"cate_name": "",
|
||||
|
@ -317,7 +334,10 @@
|
|||
"mer_cate_id": [],
|
||||
"mer_cate_name": "",
|
||||
"spec_type": "0",
|
||||
"attr": [],
|
||||
attr: [{
|
||||
detail: [],
|
||||
value: ""
|
||||
}, ],
|
||||
"specifica": "",
|
||||
"delivery_way": [],
|
||||
"delivery_free": "",
|
||||
|
@ -429,15 +449,15 @@
|
|||
}
|
||||
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
handleChooseImage() {
|
||||
let that = this;
|
||||
that.$util.uploadImageOne('upload/image', function(res) {
|
||||
if (that.isDetail) {
|
||||
that.formData.content.image.push(res.data.path);
|
||||
} else {
|
||||
that.formData.imageList.push(res.data.path);
|
||||
}
|
||||
that.$util.uploadImages({
|
||||
count: 6,
|
||||
url: 'upload/image'
|
||||
}, function(res) {
|
||||
that.formData.imageList.push(res.data.path);
|
||||
});
|
||||
},
|
||||
// 上传视频
|
||||
|
@ -579,41 +599,37 @@
|
|||
.catch(rej => {
|
||||
// Toast(rej);
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
initFormData(option) {
|
||||
this.delivery_way = this.$store.state.app.userInfo?.mer_info.delivery_way.split(',')
|
||||
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
|
||||
this.mer_id = option.mer_id
|
||||
if (option.formData) {
|
||||
this.formData = JSON.parse(option.formData)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onLoad(option) {
|
||||
this.delivery_way = this.$store.state.app.userInfo?.mer_info.delivery_way.split(',')
|
||||
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
|
||||
this.mer_id = option.mer_id
|
||||
this.initFormData(option)
|
||||
this.showSet = option.showSet ? JSON.parse(option.showSet) : this.showSet
|
||||
if (option.typeData) {
|
||||
this.formData.cate_name = JSON.parse(option.typeData).label
|
||||
this.formData.cate_id = JSON.parse(option.typeData).value
|
||||
}
|
||||
if (option.formData) {
|
||||
let data = JSON.parse(option.formData)
|
||||
for (let key in data) {
|
||||
this.formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
let that = this
|
||||
this.isSet2()
|
||||
if (option.product_id) {
|
||||
that.formData.product_id = option.product_id
|
||||
this.mode = 'edit'
|
||||
this.showSet = true
|
||||
productDetail(option.mer_id, option.product_id).then(res => {
|
||||
this.formData = res.data
|
||||
//该死的后端,格式不按添加的格式来
|
||||
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
|
||||
this.formData.cate_name = this.formData.storeCategory.cate_name
|
||||
this.formData.cate_id = this.formData.storeCategory.store_category_id
|
||||
this.formData.imageList = this.formData.image_list
|
||||
})
|
||||
}
|
||||
|
||||
console.log(this.formData)
|
||||
// console.log(this.isSet(this.formData.attrValue))
|
||||
},
|
||||
onBackPress: function(e) {
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<view class="Positioning " style="color: #989898;margin-bottom: 30rpx;">
|
||||
<view class="" style="display: flex;" @click="confirm">
|
||||
<u-icon name="map" style='margin-right: 8rpx;'></u-icon>
|
||||
<text>{{address.province}}{{address.city}}{{address.district}}</text>
|
||||
<text>{{(address.province+address.city+address.district )||errMag}} </text>
|
||||
</view>
|
||||
<view class="" @click="getLocation">
|
||||
刷新定位
|
||||
|
@ -103,7 +103,6 @@
|
|||
请选择
|
||||
</view>
|
||||
<view class="position-content">
|
||||
|
||||
<view class="position-li" :class="{act:address[wacthType()]==item.name}"
|
||||
v-for="item in positionList" @click="chosePosition(item)">
|
||||
<text>
|
||||
|
@ -184,7 +183,7 @@
|
|||
|
||||
data() {
|
||||
return {
|
||||
|
||||
errMag: "",
|
||||
provinceList: [],
|
||||
cityList: [],
|
||||
districtList: [],
|
||||
|
@ -303,22 +302,30 @@
|
|||
}).then(res => {
|
||||
this.cityList = res.data
|
||||
this.positionList = this.cityList
|
||||
this.cityList.forEach(item => {
|
||||
if (this.address.city == item.name) {
|
||||
this.address.city_code = item.code
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
choseArea() {
|
||||
this.positionType = 2;
|
||||
console.log(this.address)
|
||||
getArea({
|
||||
city_code: this.address.city_code
|
||||
}).then(res => {
|
||||
this.areaList = res.data
|
||||
this.positionList = this.areaList
|
||||
|
||||
})
|
||||
},
|
||||
getLocation() {
|
||||
let that = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
type: 'wgs84',
|
||||
success: function(res) {
|
||||
console.log(res, 'res')
|
||||
getGeocoder({
|
||||
lat: res.latitude,
|
||||
long: res.longitude
|
||||
|
@ -331,6 +338,7 @@
|
|||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log("获取位置失败")
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
|
@ -338,13 +346,16 @@
|
|||
})
|
||||
|
||||
|
||||
},
|
||||
fail: function(err) {
|
||||
that.errMag = "获取位置失败,请手动先择"
|
||||
console.log('sad', err)
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
let that = this
|
||||
console.log(this.mer_id)
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${that.mer_id}&&formData=${JSON.stringify(that.formData) }`
|
||||
})
|
||||
|
||||
|
@ -354,6 +365,7 @@
|
|||
onLoad(option) {
|
||||
getProvince().then(res => {
|
||||
this.provinceList = res.data
|
||||
this.positionList = res.data
|
||||
})
|
||||
this.formData = JSON.parse(option.formData)
|
||||
if (option.mer_id) {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="">
|
||||
<u-button icon="plus" text="新增规格" @click="attrValue.push({is_use:true}),attr.push({value:'',detail: [],})"
|
||||
<u-button icon="plus" text="新增规格"
|
||||
@click="formData.attrValue.push({is_use:true}),formData.attr.push({value:'',detail: [],})"
|
||||
class="custom-style" iconColor='#38BE41'></u-button>
|
||||
</view>
|
||||
<view class="card" v-for="(item,index) in attrValue">
|
||||
<view class="card-head card-li">
|
||||
<text style="font-size: 32rpx;font-family: PingFangFamily;">规格{{index+1}}</text>
|
||||
<view class="" style="width: 300rpx;">
|
||||
<u--input placeholder="请输入规格名称" inputAlign='right' v-model="attr[index].value"></u--input>
|
||||
<u--input placeholder="请输入规格名称" inputAlign='right' v-model="formData.attr[index].value"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<u-line direction="row" style="margin: 30rpx 0;" color="#ECECEC"></u-line>
|
||||
|
@ -51,7 +52,8 @@
|
|||
</view>
|
||||
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
|
||||
<view class="card-li">
|
||||
<view style="display: flex;color: #777777;" @click="attrValue.splice(index,1)">
|
||||
<view style="display: flex;color: #777777;"
|
||||
@click="attrValue.splice(index,1),formData.attr.splice(index,1)">
|
||||
<u-icon name="trash" style='margin-right: 8rpx;'></u-icon> 删除
|
||||
</view>
|
||||
<view class="" style="display: flex;align-items: center;">
|
||||
|
@ -67,6 +69,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
formatDate
|
||||
} from '../../../libs/uniApi'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -75,62 +80,62 @@
|
|||
text: "",
|
||||
value: "",
|
||||
formData: {},
|
||||
attr: [{
|
||||
detail: [],
|
||||
value: ""
|
||||
}, ],
|
||||
attrValue: [{
|
||||
spec_type: "",
|
||||
"attrValue": [{
|
||||
"price": "",
|
||||
"unit_name": "",
|
||||
"wholesale_unit_name": "",
|
||||
"wholesale_price": "",
|
||||
"cost": "",
|
||||
"stock": "",
|
||||
"ot_price": "",
|
||||
"procure_price": "",
|
||||
"bar_code": "",
|
||||
"weight": "",
|
||||
"volume": "",
|
||||
"extension_one": "",
|
||||
"extension_two": "",
|
||||
"is_use": 0,
|
||||
"spec_type": ""
|
||||
}],
|
||||
|
||||
"price": "",
|
||||
"unit_name": "",
|
||||
"wholesale_unit_name": "",
|
||||
"wholesale_price": '',
|
||||
"cost": "",
|
||||
"stock": "",
|
||||
"ot_price": "",
|
||||
"procure_price": "",
|
||||
"bar_code": "",
|
||||
"weight": "",
|
||||
"volume": "",
|
||||
"extension_one": "",
|
||||
"extension_two": "",
|
||||
is_use: true
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
this.attrValue.forEach(item => {
|
||||
item.is_use ? item.is_use = 0 : item.is_use = 1
|
||||
})
|
||||
this.formData.attrValue = this.attrValue
|
||||
this.formData.attr = this.attr
|
||||
|
||||
this.formData.attrValue.forEach(item => {
|
||||
item.is_use = item.is_use ? '0' : '1'
|
||||
})
|
||||
let that = this
|
||||
uni.navigateTo({
|
||||
uni.reLaunch({
|
||||
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${that.mer_id}&&formData=${JSON.stringify(that.formData) }&&showSet=${true}`
|
||||
})
|
||||
},
|
||||
initFomrData(option) {
|
||||
if (option.mer_id) {
|
||||
this.mer_id = option.mer_id
|
||||
}
|
||||
if (option.formData) {
|
||||
this.formData = JSON.parse(option.formData)
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
|
||||
if (option.formData) {
|
||||
this.formData = JSON.parse(option.formData)
|
||||
this.attrValue = this.formData.attrValue
|
||||
this.attr = this.formData.attr
|
||||
|
||||
this.attrValue.forEach(item => {
|
||||
item.is_use = !Boolean(item.is_use)
|
||||
this.initFomrData(option)
|
||||
this.attrValue = this.formData.attrValue
|
||||
this.attrValue.forEach(item => {
|
||||
item.is_use = !Boolean(Number(item.is_use))
|
||||
})
|
||||
if (this.formData.attr.length == 0) {
|
||||
this.formData.attr.push({
|
||||
value: '',
|
||||
detail: [],
|
||||
})
|
||||
|
||||
}
|
||||
if (option.mer_id) {
|
||||
this.mer_id = option.mer_id
|
||||
}
|
||||
console.log(this.mer_id, 'meridd')
|
||||
console.log(this.formData)
|
||||
console.log(this.attrValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,37 +68,39 @@
|
|||
})
|
||||
},
|
||||
navgo() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/addGoodDetail/goodsType?mer_id=${this.mer_id}&&type=${this.type}`
|
||||
uni.redirectTo({
|
||||
url: `/pages/product/addGoodDetail/goodsType?mer_id=${this.mer_id}&&type=${this.type}&&formData=${JSON.stringify(this.formData)}`
|
||||
})
|
||||
},
|
||||
hdChose(item) {
|
||||
this.formData.cate_name = item.label.includes('--') ? item.label
|
||||
.split('--')[1] : item.label;
|
||||
this.formData.cate_id = item.value
|
||||
categorySearchHistory(this.mer_id, this.$store.state.app.userInfo.uid, {
|
||||
cate_id: item.value
|
||||
})
|
||||
uni.redirectTo({
|
||||
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}&&formData=${JSON.stringify(this.formData)}`
|
||||
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&formData=${JSON.stringify(this.formData)}`
|
||||
})
|
||||
},
|
||||
initFormData(option) {
|
||||
this.mer_id = option.mer_id
|
||||
if (option.type) {
|
||||
this.type = 'simple'
|
||||
}
|
||||
this.formData = JSON.parse(option.formData)
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.mer_id = option.mer_id
|
||||
if (option.type) {
|
||||
this.type = 'simple'
|
||||
}
|
||||
this.formData = JSON.parse(option.formData)
|
||||
if (option.formData) {}
|
||||
this.initFormData(option)
|
||||
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
|
||||
|
||||
})
|
||||
|
||||
)
|
||||
label: item.cate_name,
|
||||
value: item.store_category_id
|
||||
}))
|
||||
this.typeList = res.data.active_cate.map(item => ({
|
||||
label: item.cate_name,
|
||||
value: item.store_category_id
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
<text style="margin-left: 48rpx;color: #20B128;">生鲜--水果阿萨</text>
|
||||
</view> -->
|
||||
<view class="content">
|
||||
<view class="lines" :style="{top:(actIndex*82)+30+'rpx'}" />
|
||||
<view class="lines" :style="{top:(actIndex*40)+16+'px'}" />
|
||||
<view class="left">
|
||||
<view class="left-li" v-for="(item,index) in leftList" :class="actIndex==index?'act-li':''"
|
||||
@click="hdClcik(index)">
|
||||
@click="hdClick(index)">
|
||||
{{item.label}}
|
||||
</view>
|
||||
</view>
|
||||
|
@ -16,8 +16,8 @@
|
|||
<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>
|
||||
<u-search :showAction="true" v-model="keyword" actionText="搜索" :animation="true" @search='hdSearch'
|
||||
@custom='hdSearch'> </u-search>
|
||||
<view style="margin: 30rpx 0;font-size: 28rpx; color: #989898;">
|
||||
可能在找
|
||||
</view>
|
||||
|
@ -38,6 +38,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
formatDate
|
||||
} from '../../../libs/uniApi';
|
||||
import {
|
||||
categoryList,
|
||||
categorySearch
|
||||
|
@ -57,19 +60,23 @@
|
|||
},
|
||||
methods: {
|
||||
|
||||
hdClcik(index) {
|
||||
hdClick(index) {
|
||||
this.actIndex = index
|
||||
this.rightList = this.leftList[index].children
|
||||
},
|
||||
choseType(item) {
|
||||
|
||||
this.formData.cate_name = item.label.includes('--') ? item.label
|
||||
.split('--')[1] : item.label;
|
||||
this.formData.cate_id = item.value
|
||||
if (this.type == 'detail') {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&typeData=${JSON.stringify(item)}&&formData=${JSON.stringify(this.formData)} `
|
||||
uni.redirectTo({
|
||||
url: `/pages/product/addGoodDetail/addGoodDetail?mer_id=${this.mer_id}&&formData=${JSON.stringify(this.formData)} `
|
||||
})
|
||||
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&data=${JSON.stringify(item)}&&formData=${JSON.stringify(this.formData)}`
|
||||
uni.redirectTo({
|
||||
url: `/pages/product/addGood/addGood?mer_id=${this.mer_id}&&formData=${JSON.stringify(this.formData)}`
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -79,23 +86,19 @@
|
|||
keyword: this.keyword
|
||||
}).then(res => {
|
||||
this.rightList = res.data
|
||||
console.log(res)
|
||||
})
|
||||
// categorySearch(this.mer_id) {
|
||||
|
||||
// }
|
||||
|
||||
},
|
||||
initFormData(option) {
|
||||
this.mer_id = option.mer_id
|
||||
if (option.type) {
|
||||
this.type = 'simple'
|
||||
}
|
||||
this.formData = JSON.parse(option.formData)
|
||||
}
|
||||
|
||||
},
|
||||
onLoad(option) {
|
||||
this.mer_id = option.mer_id
|
||||
if (option.type) {
|
||||
this.type = 'simple'
|
||||
}
|
||||
if (option.formData) {
|
||||
this.formData = JSON.parse(option.formData)
|
||||
}
|
||||
this.initFormData(option)
|
||||
categoryList(option.mer_id).then((res) => {
|
||||
this.leftList = res.data
|
||||
this.rightList = res.data[0].children
|
||||
|
@ -112,14 +115,14 @@
|
|||
.content {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
padding: 15px;
|
||||
background-color: white;
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
font-family: PingFangRegular;
|
||||
|
||||
.lines {
|
||||
height: 38rpx;
|
||||
height: 16px;
|
||||
border-radius: 5px;
|
||||
width: 3px;
|
||||
background-color: #40AE36;
|
||||
|
@ -140,7 +143,8 @@
|
|||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #444444;
|
||||
height: 82rpx;
|
||||
height: 40px;
|
||||
/* border-top: 1px solid red; */
|
||||
}
|
||||
|
||||
.act-li {
|
||||
|
@ -153,6 +157,8 @@
|
|||
position: fixed;
|
||||
width: 530rpx;
|
||||
left: 220rpx;
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.right-content {
|
||||
display: flex;
|
||||
|
|
|
@ -58,8 +58,48 @@
|
|||
|
||||
<view class="wrapper" style="background-color: #F1F1F1;">
|
||||
<view class='product_list' v-if="productList && productList.length > 0">
|
||||
<view v-for="(item,index) in productList" :key="index" style="position: relative;width: 100%;">
|
||||
<view class='item' @click="yinc">
|
||||
<view v-for="(item,index) in productList" :key="index" class="card">
|
||||
<view class="card-top">
|
||||
<view class="" style="width: 196rpx;height: 196rpx;position: relative;margin-right: 20rpx;">
|
||||
<u--image :src="item.image" width='196rpx' height='196rpx' duration="450"></u--image>
|
||||
<view class="preview" @click="preViewImg(item.image)">
|
||||
点击预览
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-head-right">
|
||||
<view class="" style="font-size: 32rpx;">
|
||||
{{item.store_name}}
|
||||
<view class="" style="margin-top: 10rpx;font-size: 24rpx;color: #989898;">
|
||||
库存: 96
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="" style="color: #FC452F;font-size: 24rpx;">
|
||||
<text style="font-size: 22rpx;">¥</text><text>10.00</text><text
|
||||
style="color: #828282;">/个</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="padding: 20rpx;">
|
||||
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
|
||||
</view>
|
||||
|
||||
<view class=""
|
||||
style="display: flex;justify-content: space-between;font-size: 28rpx;font-size: 28rpx;">
|
||||
<view class="" style="border-right: 1px solid #CECECE;flex: 1;text-align: center;">
|
||||
修改库存
|
||||
</view>
|
||||
<view class="" style="border-right: 1px solid #CECECE;flex: 1;text-align: center;">
|
||||
下架
|
||||
</view>
|
||||
<view class="" style="flex: 1;text-align: center;">
|
||||
编辑商品
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-footer">
|
||||
|
||||
</view>
|
||||
<!-- <view class='item' @click="yinc">
|
||||
<view class='image'>
|
||||
<image :src='item.image'></image>
|
||||
<text v-if="item.spec_type == 1" class="spec">多规格</text>
|
||||
|
@ -72,7 +112,6 @@
|
|||
</view>
|
||||
<view class="sales">
|
||||
<text class="num">库存: {{item.stock}}</text>
|
||||
<!-- <text class="num">销量: {{item.sales}}</text> -->
|
||||
</view>
|
||||
<view class="stock_type" v-if="mer_info.type_code=='TypeSupplyChain'">
|
||||
<view class="type_btn" v-for="lable in lableList" :key="lable.product_label_id"
|
||||
|
@ -94,31 +133,7 @@
|
|||
</view>
|
||||
|
||||
</view>
|
||||
<view style="position: absolute; top: 10px; right: 10px;">
|
||||
<!-- 插件无需手动引入,直接使用即可 -->
|
||||
<!-- 里面···可以改为任意东西,图片也可以 -->
|
||||
<!-- 参数$event不可修改,否则取不到点击事件详情 -->
|
||||
<!-- <rudon-rowMenuDotDotDot :localdata="options"
|
||||
@change="menuAction($event, item.attrValue,item)">
|
||||
. . .
|
||||
</rudon-rowMenuDotDotDot> -->
|
||||
<view class=""
|
||||
style='font-size: 30rpx;text-align: right;position: absolute; top: 0px; right: 10px;z-index: 999;"'
|
||||
@click="menuActiona(item,index)">
|
||||
<image src="@/static/images/dian.png" mode="aspectFill" style="width: 30rpx;height: 30rpx;
|
||||
margin-top: 40rpx;"></image>
|
||||
</view>
|
||||
|
||||
<view class="muau-header" v-if='index==num'
|
||||
style="position: absolute; top: 60rpx; right: 0px;">
|
||||
<view class="muau" v-for='(kk,i) in options'
|
||||
@click='menuAction(kk, item.attrValue,item,index)'>
|
||||
<view class="">
|
||||
{{kk.text}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="operation acea-row row-between-wrapper">
|
||||
<view class="acea-row row-middle">
|
||||
<view class="" class="bnt" @click="Fline(item)" style="width:150rpx">
|
||||
|
@ -132,11 +147,12 @@
|
|||
</view>
|
||||
<view @click="editGoods(item)" class="bnt">编辑45</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-empty v-else text="暂无商品~" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
|
||||
<u-empty v-else text="暂无商品~" mode="data" style="min-height: 80vh;"
|
||||
icon="http://cdn.uviewui.com/uview/empty/data.png">
|
||||
</u-empty>
|
||||
</view>
|
||||
<Loading :loaded="loaded" :loading="loading"></Loading>
|
||||
|
@ -149,7 +165,7 @@
|
|||
<view class="footer-li">
|
||||
扫码入库
|
||||
</view>
|
||||
<view class="footer-li">
|
||||
<view class="footer-li act">
|
||||
发布商品
|
||||
</view>
|
||||
|
||||
|
@ -331,6 +347,22 @@
|
|||
},
|
||||
|
||||
methods: {
|
||||
preViewImg(url) {
|
||||
let that = this
|
||||
uni.previewImage({
|
||||
urls: [url],
|
||||
// longPressActions: {
|
||||
// itemList: ['发送给朋友', '保存图片', '收藏'],
|
||||
// success: function(data) {
|
||||
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
||||
// },
|
||||
// fail: function(err) {
|
||||
// console.log(err.errMsg);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
},
|
||||
// 商品分类
|
||||
getCategoryList() {
|
||||
getCategoryListLevel({
|
||||
|
@ -830,6 +862,54 @@
|
|||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 718rpx;
|
||||
height: 410rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx;
|
||||
background-color: #fff;
|
||||
margin-top: 20rpx;
|
||||
position: relative;
|
||||
|
||||
.preview {
|
||||
width: 196rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.card-top {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
|
||||
.card-head-right {
|
||||
height: 196rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
// flex-wrap:;
|
||||
// flex-direction: column;
|
||||
// justify-content: sp;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
width: 713rpx;
|
||||
height: 74rpx;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
background-color: #FFF1EC;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.longTab {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
@ -1383,7 +1463,17 @@
|
|||
align-items: center;
|
||||
|
||||
.footer-li {
|
||||
border: 1px solid black;
|
||||
border: 1px solid #989898;
|
||||
font-size: 32rpx;
|
||||
padding: 14rpx 27rpx;
|
||||
border-radius: 40rpx;
|
||||
|
||||
}
|
||||
|
||||
.act {
|
||||
border: none;
|
||||
background-color: #32BB3B;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,189 +1,348 @@
|
|||
<template>
|
||||
<view class="">
|
||||
<view class="table">
|
||||
<u-sticky custom-nav-height="0" bgColor="#fff">
|
||||
<view class="line th">
|
||||
<view class="td img">图片</view>
|
||||
<view class="td sku">规格</view>
|
||||
<view class="td stock">库存</view>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<view class="line tr" v-for="(item,index) in short.attrValue" :key="index">
|
||||
<view class="td img">
|
||||
<image :src="item.image||short.image||defualtImg"></image>
|
||||
</view>
|
||||
<view class="td sku">
|
||||
<block v-if="item.sku">
|
||||
<view v-for="name in item.sku.split(',')">{{name}}</view>
|
||||
</block>
|
||||
<view v-else>{{short.store_name}}</view>
|
||||
</view>
|
||||
<view class="td stock">
|
||||
<input type="number" v-model="item.stock" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 150rpx;"></view>
|
||||
<view class="btn-view">
|
||||
<button class="btn" @click="show=true">确认修改</button>
|
||||
</view>
|
||||
<u-modal :show="show" :closeOnClickOverlay="true" title="提示" content="确定更新库存吗" showCancelButton @confirm="onUpdate" @cancel="show=false"></u-modal>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="head">
|
||||
<view class="" style="width: 210rpx;height: 210rpx;position: relative;">
|
||||
<u--image :src="short.attrValue[0].image||short.image||defualtImg" width='210rpx' height='210rpx'
|
||||
duration="450"></u--image>
|
||||
<view class="preview" @click="preViewImg(short.attrValue[0].image||short.image||defualtImg)">
|
||||
点击预览
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="right">
|
||||
<view class="">
|
||||
<view class="" style="font-size: 32rpx;color: #444444;">
|
||||
打扫房间好看
|
||||
</view>
|
||||
<view class="" style="font-size: 24rpx;color: #989898;margin-top: 10rpx;">
|
||||
库存: 100个
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="color: #FC452F;font-size: 24rpx;">
|
||||
<text style="font-size: 22rpx;">¥</text><text>10.00</text><text style="color: #828282;">/个</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="attr">
|
||||
<view class="attr-tit">
|
||||
这是大苏打
|
||||
</view>
|
||||
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
|
||||
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;">
|
||||
<view class="">
|
||||
商品库存
|
||||
</view>
|
||||
<view class="" style="display: flex;align-items: center;color: #FC452F;">
|
||||
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
|
||||
v-model="test"></u--input>个
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="attr">
|
||||
<view class="attr-tit">
|
||||
这是大苏打
|
||||
</view>
|
||||
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
|
||||
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;">
|
||||
<view class="">
|
||||
商品库存
|
||||
</view>
|
||||
<view class="" style="display: flex;align-items: center;color: #FC452F;">
|
||||
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
|
||||
v-model="test"></u--input>个
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="table">
|
||||
<u-sticky custom-nav-height="0" bgColor="#fff">
|
||||
<view class="line th">
|
||||
<view class="td img">图片</view>
|
||||
<view class="td sku">规格</view>
|
||||
<view class="td stock">库存</view>
|
||||
</view>
|
||||
</u-sticky>
|
||||
<view class="line tr" v-for="(item,index) in short.attrValue" :key="index">
|
||||
<view class="td img">
|
||||
<image :src="item.image||short.image||defualtImg"></image>
|
||||
</view>
|
||||
<view class="td sku">
|
||||
<block v-if="item.sku">
|
||||
<view v-for="name in item.sku.split(',')">{{name}}</view>
|
||||
</block>
|
||||
<view v-else>{{short.store_name}}</view>
|
||||
</view>
|
||||
<view class="td stock">
|
||||
<input type="number" v-model="item.stock" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 150rpx;"></view>
|
||||
<!-- <view class="btn-view">
|
||||
<button class="btn" @click="show=true">确认修改</button>
|
||||
</view> -->
|
||||
<view class="submit-btn">
|
||||
<u-button type="primary" shape="circle" text="确认修改" @click="show=true"></u-button>
|
||||
</view>
|
||||
<u-modal :show="show" :closeOnClickOverlay="true" title="提示" content="确定更新库存吗" showCancelButton
|
||||
@confirm="onUpdate" @cancel="show=false"></u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getProductDetail,
|
||||
} from '@/api/store.js';
|
||||
import {
|
||||
productDetail,
|
||||
productUpdateFree
|
||||
} from "@/api/product.js"
|
||||
import { Toast } from '../../../libs/uniApi';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
defualtImg: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
|
||||
mer_id: '',
|
||||
short: {
|
||||
product_id: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.short.product_id = options.product_id;
|
||||
let userInfo = this.$store.state.app.userInfo;
|
||||
if(typeof userInfo == 'string')userInfo = JSON.parse(userInfo);
|
||||
this.mer_id = userInfo.service.mer_id;
|
||||
this.initInfo();
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
initInfo() {
|
||||
productDetail(this.mer_id, this.short.product_id).then((res) => {
|
||||
this.short = res.data;
|
||||
console.log({...res.data});
|
||||
})
|
||||
},
|
||||
onUpdate(){
|
||||
let obj = {
|
||||
"attr": this.short.attr,
|
||||
"attrValue": this.short.attrValue,
|
||||
"mer_cate_id": this.short.merCateId||[],
|
||||
"spec_type": this.short.spec_type,
|
||||
"is_stock": 1
|
||||
};
|
||||
// return console.log({...obj},this.short.product_id);
|
||||
productUpdateFree(this.short.product_id, obj).then(res => {
|
||||
this.show = false;
|
||||
this.$nextTick(()=>{
|
||||
Toast('更新成功');
|
||||
})
|
||||
uni.navigateBack({
|
||||
success:()=> {
|
||||
let stock = 0;
|
||||
this.short.attrValue.forEach(item=>{
|
||||
stock = stock + parseInt(item.stock);
|
||||
})
|
||||
uni.$emit('updateStock', {
|
||||
product_id: this.short.product_id,
|
||||
stock: stock
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
this.show = false;
|
||||
this.$util.Tips({
|
||||
title: err
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
import {
|
||||
getProductDetail,
|
||||
} from '@/api/store.js';
|
||||
import {
|
||||
productDetail,
|
||||
productUpdateFree
|
||||
} from "@/api/product.js"
|
||||
import {
|
||||
Toast
|
||||
} from '../../../libs/uniApi';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
test: '20',
|
||||
show: false,
|
||||
defualtImg: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
|
||||
mer_id: '',
|
||||
short: {
|
||||
product_id: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.short.product_id = options.product_id;
|
||||
let userInfo = this.$store.state.app.userInfo;
|
||||
if (typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
|
||||
this.mer_id = userInfo.service.mer_id;
|
||||
this.initInfo();
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
preViewImg(url) {
|
||||
let that = this
|
||||
uni.previewImage({
|
||||
urls: [url],
|
||||
// longPressActions: {
|
||||
// itemList: ['发送给朋友', '保存图片', '收藏'],
|
||||
// success: function(data) {
|
||||
// console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
||||
// },
|
||||
// fail: function(err) {
|
||||
// console.log(err.errMsg);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
},
|
||||
initInfo() {
|
||||
productDetail(this.mer_id, this.short.product_id).then((res) => {
|
||||
this.short = res.data;
|
||||
console.log({
|
||||
...res.data
|
||||
});
|
||||
})
|
||||
},
|
||||
onUpdate() {
|
||||
let obj = {
|
||||
"attr": this.short.attr,
|
||||
"attrValue": this.short.attrValue,
|
||||
"mer_cate_id": this.short.merCateId || [],
|
||||
"spec_type": this.short.spec_type,
|
||||
"is_stock": 1
|
||||
};
|
||||
// return console.log({...obj},this.short.product_id);
|
||||
productUpdateFree(this.short.product_id, obj).then(res => {
|
||||
this.show = false;
|
||||
this.$nextTick(() => {
|
||||
Toast('更新成功');
|
||||
})
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
let stock = 0;
|
||||
this.short.attrValue.forEach(item => {
|
||||
stock = stock + parseInt(item.stock);
|
||||
})
|
||||
uni.$emit('updateStock', {
|
||||
product_id: this.short.product_id,
|
||||
stock: stock
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
this.show = false;
|
||||
this.$util.Tips({
|
||||
title: err
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.table{
|
||||
background-color: #fff;
|
||||
border-top: 1rpx solid rgba(0,0,0,0.1);
|
||||
border-left: 1rpx solid rgba(0,0,0,0.1);
|
||||
border-right: 1rpx solid rgba(0,0,0,0.1);
|
||||
font-size: 28rpx;
|
||||
.line{
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid rgba(0,0,0,0.1);
|
||||
.img{
|
||||
// width:140rpx;
|
||||
width: 200rpx;
|
||||
}
|
||||
.sku{
|
||||
flex: 1;
|
||||
border-left: 1rpx solid rgba(0,0,0,0.1);
|
||||
border-right: 1rpx solid rgba(0,0,0,0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.stock{
|
||||
width: 200rpx;
|
||||
input{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
color: #F84221;
|
||||
}
|
||||
}
|
||||
}
|
||||
.th{
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.tr{
|
||||
min-height: 140rpx;
|
||||
.td{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.img{
|
||||
image{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
}
|
||||
.sku{
|
||||
padding: 16rpx 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn-view{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 130rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid rgba(0,0,0,0.1);
|
||||
|
||||
.btn{
|
||||
background: linear-gradient(180deg, #FF6D20 0%, #F84221 100%);
|
||||
// background-color: #FF6D20;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
width: 694rpx;
|
||||
text-align: center;
|
||||
border-radius: 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
padding: 20rpx 16rpx;
|
||||
background-color: #F1F1F1;
|
||||
min-height: 100vh;
|
||||
|
||||
.head {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.right {
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.attr {
|
||||
width: 690rpx;
|
||||
margin: 22rpx auto;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
|
||||
.attr-tit {
|
||||
margin-left: 16rpx;
|
||||
font-size: 32rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.attr-tit::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 8rpx;
|
||||
height: 32rpx;
|
||||
background-color: #40AE36;
|
||||
border-radius: 4rpx;
|
||||
left: -16rpx;
|
||||
top: 10rpx;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.preview {
|
||||
width: 210rpx;
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
width: 670rpx;
|
||||
}
|
||||
|
||||
// old
|
||||
|
||||
.table {
|
||||
background-color: #fff;
|
||||
border-top: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
border-left: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
border-right: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
font-size: 28rpx;
|
||||
|
||||
.line {
|
||||
display: flex;
|
||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.img {
|
||||
// width:140rpx;
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
.sku {
|
||||
flex: 1;
|
||||
border-left: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
border-right: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.stock {
|
||||
width: 200rpx;
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
color: #F84221;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.th {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tr {
|
||||
min-height: 140rpx;
|
||||
|
||||
.td {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.img {
|
||||
image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sku {
|
||||
padding: 16rpx 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn-view {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 130rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-top: 1rpx solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.btn {
|
||||
background: linear-gradient(180deg, #FF6D20 0%, #F84221 100%);
|
||||
// background-color: #FF6D20;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
width: 694rpx;
|
||||
text-align: center;
|
||||
border-radius: 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -590,28 +590,28 @@ export default {
|
|||
*/
|
||||
uploadImageOne: function(opt, successCallback, errorCallback) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
let obj = {};
|
||||
if (typeof opt === 'string') {
|
||||
let url = opt;
|
||||
opt = {};
|
||||
opt.url = url;
|
||||
}else {
|
||||
opt.crop ? obj.crop = opt.crop : null;
|
||||
}
|
||||
} else {
|
||||
opt.crop ? obj.crop = opt.crop : null;
|
||||
}
|
||||
let count = opt.count || 1,
|
||||
sizeType = opt.sizeType || ['compressed'],
|
||||
sourceType = opt.sourceType || ['album', 'camera'],
|
||||
is_load = opt.is_load || true,
|
||||
uploadUrl = opt.url || '',
|
||||
inputName = opt.name || 'field';
|
||||
|
||||
|
||||
uni.chooseImage({
|
||||
count: count, //最多可以选择的图片总数
|
||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
||||
...obj,
|
||||
...obj,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
console.log(res);
|
||||
//启动上传等待中...
|
||||
uni.showLoading({
|
||||
title: '图片上传中',
|
||||
|
@ -657,6 +657,84 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
/*
|
||||
* 多上传
|
||||
* @param object opt
|
||||
* @param callable successCallback 成功执行方法 data
|
||||
* @param callable errorCallback 失败执行方法
|
||||
*/
|
||||
uploadImages: function(opt, successCallback, errorCallback) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
if (typeof opt === 'string') {
|
||||
let url = opt;
|
||||
opt = {};
|
||||
opt.url = url;
|
||||
} else {
|
||||
opt.crop ? obj.crop = opt.crop : null;
|
||||
}
|
||||
let count = opt.count || 1,
|
||||
sizeType = opt.sizeType || ['compressed'],
|
||||
sourceType = opt.sourceType || ['album', 'camera'],
|
||||
is_load = opt.is_load || true,
|
||||
uploadUrl = opt.url || '',
|
||||
inputName = opt.name || 'field';
|
||||
|
||||
uni.chooseImage({
|
||||
count: count, //最多可以选择的图片总数
|
||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
||||
...obj,
|
||||
success: function(res) {
|
||||
console.log(res.tempFilePaths);
|
||||
//启动上传等待中...
|
||||
uni.showLoading({
|
||||
title: '图片上传中',
|
||||
});
|
||||
res.tempFilePaths.forEach((item, index) => {
|
||||
uni.uploadFile({
|
||||
url: HTTP_REQUEST_URL + '/api/' + uploadUrl + '/' + inputName,
|
||||
filePath: item,
|
||||
name: inputName,
|
||||
formData: {
|
||||
'filename': inputName
|
||||
},
|
||||
header: {
|
||||
// #ifdef MP
|
||||
"Content-Type": "multipart/form-data",
|
||||
// #endif
|
||||
[TOKENNAME]: 'Bearer ' + store.state.app.token
|
||||
},
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
if (res.statusCode == 403) {
|
||||
that.Tips({
|
||||
title: res.data
|
||||
});
|
||||
} else {
|
||||
let data = res.data ? JSON.parse(res.data) : {};
|
||||
if (data.status == 200) {
|
||||
successCallback && successCallback(data)
|
||||
} else {
|
||||
errorCallback && errorCallback(data);
|
||||
that.Tips({
|
||||
title: data.message
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
uni.hideLoading();
|
||||
that.Tips({
|
||||
title: '上传图片失败'
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 小程序头像获取上传
|
||||
* @param uploadUrl 上传接口地址
|
||||
|
|
Loading…
Reference in New Issue