更新
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
|
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="商品上架:" name="productStatus">
|
<uni-forms-item label="商品上架:" name="productStatus">
|
||||||
<switch v-model="productDate.productStatus" color="#FE0606" checked style="transform:scale(0.7)" />
|
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'" color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="商品推荐:" name="age">
|
<uni-forms-item label="商品推荐:" name="age">
|
||||||
<view class='checkbox-con'>
|
<view class='checkbox-con'>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
></uni-data-select>
|
></uni-data-select>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<view class="content" v-show="productDate.attributesTypeId">
|
<view class="content" v-show="productDate.attributesTypeId">
|
||||||
<view>商品类型:</view>
|
<view style="margin: 10rpx 0;">商品类型:</view>
|
||||||
<view>
|
<view>
|
||||||
<uni-section type="line">
|
<uni-section type="line">
|
||||||
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
||||||
@@ -83,36 +83,37 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>批量填充:<text style="color: #999999;">批量填充填入信息后,可以批量将内容填写到SKU 信息里</text></view>
|
<view>批量填充:<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后,可以批量将内容填写到SKU 信息里</text></view>
|
||||||
<view class="tagButton" :class="item.checked == true?'checkedTag':''" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
|
<view class="tagButton" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
|
||||||
<view class="redButton" @tap="addStockList">确定</view>
|
<view class="redButton" @tap="addStockList">确定</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="productDate.attributesTypeId&&checkboxAttributes.length>0" v-for="(items,index) in checkboxAttributes">
|
<view v-for="(items,index) in stockList">
|
||||||
<view>
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
<text>规格:</text>
|
<text>规格:</text>
|
||||||
<text>{{radioAttributes}}+{{items}}</text>
|
<text v-if="index==0">{{radioAttributes}}</text>
|
||||||
|
<text v-if="index!=0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton" v-if="item.checked==true" v-for="item in stockList">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="item.value" :placeholder="item.label" />
|
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
|
||||||
</view>
|
</view>
|
||||||
<view style="display: inline-block;" @click="deleteCheckAll(index)">删除</view>
|
<view class="tagButton">
|
||||||
</view>
|
<input type="text" v-model="items.sellPrice" placeholder="销售价格" />
|
||||||
<view v-if="productDate.attributesTypeId&&radioAttributes" >
|
|
||||||
<view>
|
|
||||||
<text style="color: red;">*</text>
|
|
||||||
<text>规格:</text>
|
|
||||||
<text>{{radioAttributes}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton" v-if="item.checked==true" v-for="item in bottonList">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="item.value" :placeholder="item.label" />
|
<input type="text" v-model="items.stock" placeholder="库存数量" />
|
||||||
</view>
|
</view>
|
||||||
<view style="display: inline-block;" @click="deleteRadio">删除</view>
|
<view class="tagButton">
|
||||||
|
<input type="text" v-model="items.integral" placeholder="积分价值" />
|
||||||
|
</view>
|
||||||
|
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;" @click="deleteCheckAll(index)">删除</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
商品图片:<text style="color: #999999;">最多可上传10张图片</text></view>
|
商品图片:
|
||||||
|
<text style="color: #999999;">最多可上传10张图片</text>
|
||||||
|
</view>
|
||||||
<view class="imageList" v-for="(items,index) in productDate.images">
|
<view class="imageList" v-for="(items,index) in productDate.images">
|
||||||
<view class="imageBlack" v-if="items.mainMark==1">
|
<view class="imageBlack" v-if="items.mainMark==1">
|
||||||
<image :src="items.url"></image>
|
<image :src="items.url"></image>
|
||||||
@@ -121,12 +122,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="imageBlack" v-else-if="items.mainMark!=1">
|
<view class="imageBlack" v-else-if="items.mainMark!=1">
|
||||||
<image :src="items.url"></image>
|
<image :src="items.url"></image>
|
||||||
<view class="cameraText">设为主图</view>
|
<view class="cameraText" @click="setMainImage(index)">设为主图</view>
|
||||||
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
|
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="imageBlack" @tap="takePhoto">
|
<view class="imageBlack" style="background-color: #fafafa;" @tap="srcFileImage">
|
||||||
<view style="cameraImage">
|
<view style="margin-top: 46rpx;">
|
||||||
<uni-icons type="camera-filled" size="30"></uni-icons>
|
<uni-icons type="camera-filled" size="30"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -159,7 +160,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentBoxId: 'instruction', //当前显示的view的id
|
currentBoxId: 'chooseType', //当前显示的view的id
|
||||||
isBoxShow: false,
|
isBoxShow: false,
|
||||||
productDate:{
|
productDate:{
|
||||||
images:[]
|
images:[]
|
||||||
@@ -193,8 +194,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad() {
|
||||||
// this.get(options.orderId)
|
|
||||||
this.classfication()
|
this.classfication()
|
||||||
this.getProductBrands()
|
this.getProductBrands()
|
||||||
this.getAttributesType()
|
this.getAttributesType()
|
||||||
@@ -208,6 +208,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
switchChange(e){
|
||||||
|
if(e.detail.value == true){
|
||||||
|
this.productDate.productStatus = '1'
|
||||||
|
}else if(e.detail.value == false){
|
||||||
|
this.productDate.productStatus = '2'
|
||||||
|
}
|
||||||
|
},
|
||||||
classfication(){
|
classfication(){
|
||||||
serve.classification().then(res=>{
|
serve.classification().then(res=>{
|
||||||
this.productList = res.data
|
this.productList = res.data
|
||||||
@@ -304,90 +311,43 @@
|
|||||||
this.checkboxAttributes.splice(i,1)
|
this.checkboxAttributes.splice(i,1)
|
||||||
this.radioAttributes = ''
|
this.radioAttributes = ''
|
||||||
}
|
}
|
||||||
|
this.stockList.splice(i,1)
|
||||||
},
|
},
|
||||||
deleteRadio(){
|
deleteRadio(){
|
||||||
this.radioAttributes = ''
|
this.radioAttributes = ''
|
||||||
},
|
},
|
||||||
changeChecked(item){
|
changeChecked(item){
|
||||||
|
|
||||||
item.checked = !item.checked
|
item.checked = !item.checked
|
||||||
console.log(this.radioAttributes,this.checkboxAttributes)
|
|
||||||
|
|
||||||
},
|
},
|
||||||
addStockList(){
|
addStockList(){
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
let obj = {}
|
let obj = {
|
||||||
this.bottonList.forEach(tab=>{
|
marketPrice:'',
|
||||||
if(tab.checked == true){
|
sellPrice:'',
|
||||||
if(tab.value == 'marketPrice'){
|
stock:'',
|
||||||
obj.marketPrice = ''
|
integral:''
|
||||||
}else if(tab.value == 'sellPrice'){
|
}
|
||||||
obj.sellPrice = ''
|
if(this.attributesList.length ==1){
|
||||||
}else if(tab.value == 'stock'){
|
let data = {}
|
||||||
obj.stock = ''
|
let name = this.attributesList[0].attributeName
|
||||||
}else if(tab.value == 'integral'){
|
let value = this.radioAttributes
|
||||||
obj.integral = ''
|
data[name] = value
|
||||||
}
|
obj.attributeJson = JSON.stringify(data)
|
||||||
}
|
this.stockList.push(obj)
|
||||||
})
|
}else{
|
||||||
this.stockList.push(obj)
|
this.checkboxAttributes.forEach((tab,index)=>{
|
||||||
|
let name = this.attributesList[0].attributeName
|
||||||
|
let value = this.radioAttributes
|
||||||
|
let tabName = this.attributesList[index+1].attributeName
|
||||||
|
let tabValue = tab
|
||||||
|
data[name] = value
|
||||||
|
data[tabName] = tabValue
|
||||||
|
obj.attributeJson = JSON.stringify(data)
|
||||||
|
this.stockList.push(obj)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 调用系统相机
|
|
||||||
takePhoto() {
|
|
||||||
// 先检查权限
|
|
||||||
let _that = this
|
|
||||||
uni.getSetting({
|
|
||||||
success(res) {
|
|
||||||
if (!res.authSetting['scope.camera']) {
|
|
||||||
// 请求权限
|
|
||||||
uni.authorize({
|
|
||||||
scope: 'scope.camera',
|
|
||||||
success() {
|
|
||||||
// 权限已经获取,可以调用相机
|
|
||||||
_that.srcFileImage()
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
// 用户拒绝授权,需引导用户开启权限
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '需要相机权限才能使用相机功能,请在设置中打开',
|
|
||||||
success: (modalRes) => {
|
|
||||||
if (modalRes.confirm) {
|
|
||||||
// 引导用户去设置中打开权限
|
|
||||||
uni.openSetting({
|
|
||||||
success(res) {
|
|
||||||
if (res.authSetting['scope.camera']) {
|
|
||||||
re()
|
|
||||||
// 授权成功
|
|
||||||
} else {
|
|
||||||
// 没有允许相机权限
|
|
||||||
wx.showToast({
|
|
||||||
title: '您拒绝了相机权限,将无法使用相机功能',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
rj('拒绝了相机权限')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
rj('openSetting调用失败')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// 权限已经获取,可以直接调用相机
|
|
||||||
_that.srcFileImage()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
// 获取设置失败
|
|
||||||
console.error(err);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
//调起上传图片
|
//调起上传图片
|
||||||
srcFileImage() {
|
srcFileImage() {
|
||||||
let _that = this
|
let _that = this
|
||||||
@@ -447,6 +407,15 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setMainImage(index){
|
||||||
|
this.productDate.images.forEach((tab,i)=>{
|
||||||
|
if(i == index){
|
||||||
|
tab.mainMark = 1
|
||||||
|
}else{
|
||||||
|
tab.mainMark = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
clearImage(index){
|
clearImage(index){
|
||||||
if(this.productDate.images[index].mainMark == 1){
|
if(this.productDate.images[index].mainMark == 1){
|
||||||
this.productDate.images.splice(index,1)
|
this.productDate.images.splice(index,1)
|
||||||
@@ -455,17 +424,26 @@
|
|||||||
this.productDate.images.splice(index,1)
|
this.productDate.images.splice(index,1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
picker2(e){
|
|
||||||
console.log(e.detail.value)
|
|
||||||
this.productDate.value = e.detail.value
|
|
||||||
},
|
|
||||||
closed(){
|
closed(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addCompleted(){
|
addCompleted(){
|
||||||
|
if(this.radioItem[0].checked =true){
|
||||||
|
this.productDate.newMark == '1'
|
||||||
|
}else{
|
||||||
|
this.productDate.newMark == '2'
|
||||||
|
}
|
||||||
|
if(this.radioItem[1].checked =true){
|
||||||
|
this.productDate.recommend == '1'
|
||||||
|
}else{
|
||||||
|
this.productDate.recommend == '2'
|
||||||
|
}
|
||||||
|
this.productDate.stockList = this.stockList
|
||||||
|
serve.saveProduct(this.productDate).then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -549,7 +527,6 @@
|
|||||||
.tagButton{
|
.tagButton{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 133rpx;
|
width: 133rpx;
|
||||||
height: 58rpx;
|
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@@ -584,6 +561,8 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 140rpx;
|
width: 140rpx;
|
||||||
height: 140rpx;
|
height: 140rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
>image{
|
>image{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
:style="{background:statusEnum[item.auditStatus].color}" >{{statusEnum[item.auditStatus].value}}</view>
|
:style="{background:statusEnum[item.auditStatus].color}" >{{statusEnum[item.auditStatus].value}}</view>
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="button" @click="orderDelete">删除</view>
|
<view class="button" @click="orderDelete">删除</view>
|
||||||
<view class="button" @click="editOrder(item)">编辑</view>
|
<view class="button" @click="toEditOrder(item)">编辑</view>
|
||||||
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'上架':'下架'}}</view>
|
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'上架':'下架'}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -242,10 +242,9 @@
|
|||||||
orderDelete(){
|
orderDelete(){
|
||||||
this.$refs.delete.open('center')
|
this.$refs.delete.open('center')
|
||||||
},
|
},
|
||||||
editOrder(item){
|
toEditOrder(item){
|
||||||
console.log(item)
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `../productUpdate/index??orderId=${item.id}`
|
url: `../productUpdate/index?id=${item.id}`
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
|
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="商品上架:" name="productStatus">
|
<uni-forms-item label="商品上架:" name="productStatus">
|
||||||
<switch v-model="productDate.productStatus" color="#FE0606" checked style="transform:scale(0.7)" />
|
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'" color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="商品推荐:" name="age">
|
<uni-forms-item label="商品推荐:" name="age">
|
||||||
<view class='checkbox-con'>
|
<view class='checkbox-con'>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
></uni-data-select>
|
></uni-data-select>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<view class="content" v-show="productDate.attributesTypeId">
|
<view class="content" v-show="productDate.attributesTypeId">
|
||||||
<view>商品类型:</view>
|
<view style="margin: 10rpx 0;">商品类型:</view>
|
||||||
<view>
|
<view>
|
||||||
<uni-section type="line">
|
<uni-section type="line">
|
||||||
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
||||||
@@ -83,36 +83,37 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>批量填充:<text style="color: #999999;">批量填充填入信息后,可以批量将内容填写到SKU 信息里</text></view>
|
<view>批量填充:<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后,可以批量将内容填写到SKU 信息里</text></view>
|
||||||
<view class="tagButton" :class="item.checked == true?'checkedTag':''" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
|
<view class="tagButton" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
|
||||||
<view class="redButton" @tap="addStockList">确定</view>
|
<view class="redButton" @tap="addStockList">确定</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="productDate.attributesTypeId&&checkboxAttributes.length>0" v-for="(items,index) in checkboxAttributes">
|
<view v-for="(items,index) in stockList">
|
||||||
<view>
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
<text>规格:</text>
|
<text>规格:</text>
|
||||||
<text>{{radioAttributes}}+{{items}}</text>
|
<text v-if="index==0">{{radioAttributes}}</text>
|
||||||
|
<text v-if="index!=0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton" v-if="item.checked==true" v-for="item in stockList">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="item.value" :placeholder="item.label" />
|
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
|
||||||
</view>
|
</view>
|
||||||
<view style="display: inline-block;" @click="deleteCheckAll(index)">删除</view>
|
<view class="tagButton">
|
||||||
</view>
|
<input type="text" v-model="items.sellPrice" placeholder="销售价格" />
|
||||||
<view v-if="productDate.attributesTypeId&&radioAttributes" >
|
|
||||||
<view>
|
|
||||||
<text style="color: red;">*</text>
|
|
||||||
<text>规格:</text>
|
|
||||||
<text>{{radioAttributes}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton" v-if="item.checked==true" v-for="item in bottonList">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="item.value" :placeholder="item.label" />
|
<input type="text" v-model="items.stock" placeholder="库存数量" />
|
||||||
</view>
|
</view>
|
||||||
<view style="display: inline-block;" @click="deleteRadio">删除</view>
|
<view class="tagButton">
|
||||||
|
<input type="text" v-model="items.integral" placeholder="积分价值" />
|
||||||
|
</view>
|
||||||
|
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;" @click="deleteCheckAll(index)">删除</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
商品图片:<text style="color: #999999;">最多可上传10张图片</text></view>
|
商品图片:
|
||||||
|
<text style="color: #999999;">最多可上传10张图片</text>
|
||||||
|
</view>
|
||||||
<view class="imageList" v-for="(items,index) in productDate.images">
|
<view class="imageList" v-for="(items,index) in productDate.images">
|
||||||
<view class="imageBlack" v-if="items.mainMark==1">
|
<view class="imageBlack" v-if="items.mainMark==1">
|
||||||
<image :src="items.url"></image>
|
<image :src="items.url"></image>
|
||||||
@@ -121,12 +122,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="imageBlack" v-else-if="items.mainMark!=1">
|
<view class="imageBlack" v-else-if="items.mainMark!=1">
|
||||||
<image :src="items.url"></image>
|
<image :src="items.url"></image>
|
||||||
<view class="cameraText">设为主图</view>
|
<view class="cameraText" @click="setMainImage(index)">设为主图</view>
|
||||||
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
|
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="imageBlack" @tap="takePhoto">
|
<view class="imageBlack" style="background-color: #fafafa;" @tap="srcFileImage">
|
||||||
<view style="cameraImage">
|
<view style="margin-top: 46rpx;">
|
||||||
<uni-icons type="camera-filled" size="30"></uni-icons>
|
<uni-icons type="camera-filled" size="30"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -159,7 +160,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentBoxId: 'instruction', //当前显示的view的id
|
currentBoxId: 'chooseType', //当前显示的view的id
|
||||||
isBoxShow: false,
|
isBoxShow: false,
|
||||||
productDate:{
|
productDate:{
|
||||||
images:[]
|
images:[]
|
||||||
@@ -194,7 +195,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// this.get(options.orderId)
|
console.log(options,'options')
|
||||||
|
this.getEdit(options)
|
||||||
this.classfication()
|
this.classfication()
|
||||||
this.getProductBrands()
|
this.getProductBrands()
|
||||||
this.getAttributesType()
|
this.getAttributesType()
|
||||||
@@ -208,6 +210,56 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getEdit(options){
|
||||||
|
serve.getEdit(options.id).then(res=>{
|
||||||
|
if(res.code === 20000&&res.data!=null){
|
||||||
|
this.productDate = res.data
|
||||||
|
this.productDate.demandRegion = res.data.categoryOneId+','+res.data.categoryTwoId
|
||||||
|
if(this.productDate.newMark == '1'){
|
||||||
|
this.radioItem[0].checked =true
|
||||||
|
}else{
|
||||||
|
this.radioItem[0].checked =false
|
||||||
|
}
|
||||||
|
if(this.productDate.recommend == '1'){
|
||||||
|
this.radioItem[1].checked =true
|
||||||
|
}else{
|
||||||
|
this.radioItem[1].checked =false
|
||||||
|
}
|
||||||
|
this.attributesTypeList.forEach(tab=>{
|
||||||
|
if(tab.id = this.productDate.attributesTypeId){
|
||||||
|
this.attributesList = tab.attributesList
|
||||||
|
this.attributesList.forEach(tab=>{
|
||||||
|
tab.attributesList = []
|
||||||
|
tab.attributeContent.split(',').forEach(item=>{
|
||||||
|
tab.attributesList.push({value:item,text:item})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(this.productDate.checkedList.length==1){
|
||||||
|
this.radioAttributes = this.productDate.checkedList[0].checked
|
||||||
|
}else{
|
||||||
|
this.checkboxAttributes = []
|
||||||
|
this.productDate.checkedList.forEach((tab,index)=>{
|
||||||
|
if(index!=0){
|
||||||
|
this.checkboxAttributes.push(tab.checked)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.stockList = this.productDate.stockList
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
switchChange(e){
|
||||||
|
if(e.detail.value == true){
|
||||||
|
this.productDate.productStatus = '1'
|
||||||
|
}else if(e.detail.value == false){
|
||||||
|
this.productDate.productStatus = '2'
|
||||||
|
}
|
||||||
|
},
|
||||||
classfication(){
|
classfication(){
|
||||||
serve.classification().then(res=>{
|
serve.classification().then(res=>{
|
||||||
this.productList = res.data
|
this.productList = res.data
|
||||||
@@ -304,90 +356,43 @@
|
|||||||
this.checkboxAttributes.splice(i,1)
|
this.checkboxAttributes.splice(i,1)
|
||||||
this.radioAttributes = ''
|
this.radioAttributes = ''
|
||||||
}
|
}
|
||||||
|
this.stockList.splice(i,1)
|
||||||
},
|
},
|
||||||
deleteRadio(){
|
deleteRadio(){
|
||||||
this.radioAttributes = ''
|
this.radioAttributes = ''
|
||||||
},
|
},
|
||||||
changeChecked(item){
|
changeChecked(item){
|
||||||
|
|
||||||
item.checked = !item.checked
|
item.checked = !item.checked
|
||||||
console.log(this.radioAttributes,this.checkboxAttributes)
|
|
||||||
|
|
||||||
},
|
},
|
||||||
addStockList(){
|
addStockList(){
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
let obj = {}
|
let obj = {
|
||||||
this.bottonList.forEach(tab=>{
|
marketPrice:'',
|
||||||
if(tab.checked == true){
|
sellPrice:'',
|
||||||
if(tab.value == 'marketPrice'){
|
stock:'',
|
||||||
obj.marketPrice = ''
|
integral:''
|
||||||
}else if(tab.value == 'sellPrice'){
|
}
|
||||||
obj.sellPrice = ''
|
if(this.attributesList.length ==1){
|
||||||
}else if(tab.value == 'stock'){
|
let data = {}
|
||||||
obj.stock = ''
|
let name = this.attributesList[0].attributeName
|
||||||
}else if(tab.value == 'integral'){
|
let value = this.radioAttributes
|
||||||
obj.integral = ''
|
data[name] = value
|
||||||
}
|
obj.attributeJson = JSON.stringify(data)
|
||||||
}
|
this.stockList.push(obj)
|
||||||
})
|
}else{
|
||||||
this.stockList.push(obj)
|
this.checkboxAttributes.forEach((tab,index)=>{
|
||||||
|
let name = this.attributesList[0].attributeName
|
||||||
|
let value = this.radioAttributes
|
||||||
|
let tabName = this.attributesList[index+1].attributeName
|
||||||
|
let tabValue = tab
|
||||||
|
data[name] = value
|
||||||
|
data[tabName] = tabValue
|
||||||
|
obj.attributeJson = JSON.stringify(data)
|
||||||
|
this.stockList.push(obj)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 调用系统相机
|
|
||||||
takePhoto() {
|
|
||||||
// 先检查权限
|
|
||||||
let _that = this
|
|
||||||
uni.getSetting({
|
|
||||||
success(res) {
|
|
||||||
if (!res.authSetting['scope.camera']) {
|
|
||||||
// 请求权限
|
|
||||||
uni.authorize({
|
|
||||||
scope: 'scope.camera',
|
|
||||||
success() {
|
|
||||||
// 权限已经获取,可以调用相机
|
|
||||||
_that.srcFileImage()
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
// 用户拒绝授权,需引导用户开启权限
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '需要相机权限才能使用相机功能,请在设置中打开',
|
|
||||||
success: (modalRes) => {
|
|
||||||
if (modalRes.confirm) {
|
|
||||||
// 引导用户去设置中打开权限
|
|
||||||
uni.openSetting({
|
|
||||||
success(res) {
|
|
||||||
if (res.authSetting['scope.camera']) {
|
|
||||||
re()
|
|
||||||
// 授权成功
|
|
||||||
} else {
|
|
||||||
// 没有允许相机权限
|
|
||||||
wx.showToast({
|
|
||||||
title: '您拒绝了相机权限,将无法使用相机功能',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
rj('拒绝了相机权限')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
rj('openSetting调用失败')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// 权限已经获取,可以直接调用相机
|
|
||||||
_that.srcFileImage()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
// 获取设置失败
|
|
||||||
console.error(err);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
//调起上传图片
|
//调起上传图片
|
||||||
srcFileImage() {
|
srcFileImage() {
|
||||||
let _that = this
|
let _that = this
|
||||||
@@ -447,6 +452,15 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setMainImage(index){
|
||||||
|
this.productDate.images.forEach((tab,i)=>{
|
||||||
|
if(i == index){
|
||||||
|
tab.mainMark = 1
|
||||||
|
}else{
|
||||||
|
tab.mainMark = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
clearImage(index){
|
clearImage(index){
|
||||||
if(this.productDate.images[index].mainMark == 1){
|
if(this.productDate.images[index].mainMark == 1){
|
||||||
this.productDate.images.splice(index,1)
|
this.productDate.images.splice(index,1)
|
||||||
@@ -455,17 +469,21 @@
|
|||||||
this.productDate.images.splice(index,1)
|
this.productDate.images.splice(index,1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
picker2(e){
|
|
||||||
console.log(e.detail.value)
|
|
||||||
this.productDate.value = e.detail.value
|
|
||||||
},
|
|
||||||
closed(){
|
closed(){
|
||||||
uni.navigateTo({
|
uni.navigateBack()
|
||||||
url: '/pages/index/index'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
addCompleted(){
|
addCompleted(){
|
||||||
|
if(this.radioItem[0].checked =true){
|
||||||
|
this.productDate.newMark == '1'
|
||||||
|
}else{
|
||||||
|
this.productDate.newMark == '2'
|
||||||
|
}
|
||||||
|
if(this.radioItem[1].checked =true){
|
||||||
|
this.productDate.recommend == '1'
|
||||||
|
}else{
|
||||||
|
this.productDate.recommend == '2'
|
||||||
|
}
|
||||||
|
this.productDate.stockList = this.stockList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -549,7 +567,6 @@
|
|||||||
.tagButton{
|
.tagButton{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 133rpx;
|
width: 133rpx;
|
||||||
height: 58rpx;
|
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@@ -584,6 +601,8 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 140rpx;
|
width: 140rpx;
|
||||||
height: 140rpx;
|
height: 140rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
>image{
|
>image{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -103,6 +103,9 @@
|
|||||||
},{
|
},{
|
||||||
"path": "productAddition/index",
|
"path": "productAddition/index",
|
||||||
"style": {}
|
"style": {}
|
||||||
|
},{
|
||||||
|
"path": "productUpdate/index",
|
||||||
|
"style": {}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user