|
|
|
@ -14,7 +14,7 @@ |
|
|
|
<text class="add-paper-text">纸品名称</text> |
|
|
|
</view> |
|
|
|
<view class="add-paper-input"> |
|
|
|
<qn-easyinput type="digit" :styles="{ disableColor: '#fff' }" v-model="form.name" :inputBorder="false" text="right" placeholder="请输入纸品名称"></qn-easyinput> |
|
|
|
<qn-easyinput type="text" :styles="{ disableColor: '#fff' }" v-model="form.name" :inputBorder="false" text="right" placeholder="请输入纸品名称"></qn-easyinput> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="add-paper-border"></view> |
|
|
|
@ -25,7 +25,7 @@ |
|
|
|
</view> |
|
|
|
<view class="add-paper-input"> |
|
|
|
<qn-easyinput |
|
|
|
type="digit" |
|
|
|
type="text" |
|
|
|
:styles="{ disableColor: '#fff' }" |
|
|
|
v-model="form.manufacturerName" |
|
|
|
:inputBorder="false" |
|
|
|
@ -42,7 +42,7 @@ |
|
|
|
</view> |
|
|
|
<view class="add-paper-input"> |
|
|
|
<qn-easyinput |
|
|
|
type="digit" |
|
|
|
type="text" |
|
|
|
:styles="{ disableColor: '#fff' }" |
|
|
|
v-model="form.brandName" |
|
|
|
:inputBorder="false" |
|
|
|
@ -70,7 +70,7 @@ |
|
|
|
<text class="add-paper-start"><uni-icons custom-prefix="iconfont" type="icon-required" size="14" color="#F5222D"></uni-icons></text> |
|
|
|
<text class="add-paper-text">是否主营</text> |
|
|
|
</view> |
|
|
|
<view><uni-data-checkbox v-model="form.isMainProduct" :localdata="range" @change="change"></uni-data-checkbox></view> |
|
|
|
<view><uni-data-checkbox v-model="form.isMainProductRep" :localdata="range"></uni-data-checkbox></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<uGap></uGap> |
|
|
|
@ -281,11 +281,11 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { back, go2,uploadFile } from '@/utils/hook.js' |
|
|
|
import { back, go2, uploadFile } from '@/utils/hook.js' |
|
|
|
import qnEasyinput from '@/components/qn-easyinput/qn-easyinput.vue' |
|
|
|
import uGap from '@/components/u-gap/u-gap.vue' |
|
|
|
import { getCategoryList, createProduct, getSupplierDteail, updateProduct } from '@/apis/add-paper.js' |
|
|
|
const validateFields = ['name', 'isMainProduct', 'manufacturerName', 'brandName', 'categoryId'] |
|
|
|
const validateFields = ['name', 'isMainProductRep', 'manufacturerName', 'brandName', 'categoryId'] |
|
|
|
const validatePriceFields = ['isPromoting', 'listPrice', 'minimum', 'stock', 'stockUnit', 'weight'] |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
@ -297,7 +297,7 @@ export default { |
|
|
|
title: '添加纸品', |
|
|
|
form: { |
|
|
|
name: null, |
|
|
|
isMainProduct: 0, |
|
|
|
isMainProductRep: 0, |
|
|
|
manufacturerName: null, |
|
|
|
brandName: null, |
|
|
|
categoryId: null |
|
|
|
@ -337,24 +337,26 @@ export default { |
|
|
|
], |
|
|
|
imgList: [], |
|
|
|
priceIndex: 0, |
|
|
|
eidtFor: 0 |
|
|
|
eidtFor: 0, |
|
|
|
option: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
if (option) { |
|
|
|
this.title = option.title |
|
|
|
} |
|
|
|
this.option = option |
|
|
|
this.eidtFor = 0 |
|
|
|
if (this.title === '编辑纸品') { |
|
|
|
this.getDteailList() |
|
|
|
this.eidtFor = 1 |
|
|
|
} |
|
|
|
console.log('this.$store.state.supplierInfo.id',this.$store.state.supplierInfo.id) |
|
|
|
console.log('this.$store.state.supplierInfo.id', this.$store.state.supplierInfo.id) |
|
|
|
this.getCategoryListQuery() |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
['form.name'](val) { |
|
|
|
this.form.id = "" |
|
|
|
this.form.id = '' |
|
|
|
console.log(111) |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -379,14 +381,40 @@ export default { |
|
|
|
//获取详情 |
|
|
|
getDteailList(res) { |
|
|
|
var params = { |
|
|
|
mallSupplierIds : null, |
|
|
|
productId : null |
|
|
|
mallSupplierIds: this.$store.state.supplierInfo.supplierId, |
|
|
|
productId: this.option.id |
|
|
|
} |
|
|
|
this.getSupplierDteail(params).then(res => { |
|
|
|
getSupplierDteail(params).then(res => { |
|
|
|
if (res) { |
|
|
|
this.form = res |
|
|
|
if (this.form.isMainProduct === true) { |
|
|
|
this.$set(this.form, 'isMainProductRep', 0) |
|
|
|
} else { |
|
|
|
this.$set(this.form, 'isMainProductRep', 1) |
|
|
|
} |
|
|
|
this.skuList = res.skuList |
|
|
|
this.imgList = res.imgList |
|
|
|
for(let j = 0;j<this.skuList.length;j++){ |
|
|
|
if(this.skuList[j].isPromoting === true){ |
|
|
|
this.skuList[j].isPromoting = 0 |
|
|
|
}else{ |
|
|
|
this.skuList[j].isPromoting = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
for(let x =0;x<this.paperList.length;x++){ |
|
|
|
if(this.paperList[x].id === this.form.categoryId){ |
|
|
|
this.$set(this.form,'categoryName',this.paperList[x].name) |
|
|
|
} |
|
|
|
} |
|
|
|
this.imgList = [] |
|
|
|
for (let i = 0; i < res.imgList.length; i++) { |
|
|
|
var params = { |
|
|
|
name: 'text', |
|
|
|
extname: 'text', |
|
|
|
url: res.imgList[i] |
|
|
|
} |
|
|
|
this.imgList.push(params) |
|
|
|
} |
|
|
|
console.log('this.form',this.form) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -421,9 +449,9 @@ export default { |
|
|
|
this.imgList.push(item.tempFiles[0]) |
|
|
|
this.postuploadFile(item.tempFiles[0]) |
|
|
|
}, |
|
|
|
postuploadFile(path){ |
|
|
|
uploadFile(path.path).then(val=>{ |
|
|
|
this.imgList[this.imgList.length -1].pathUrl = val |
|
|
|
postuploadFile(path) { |
|
|
|
uploadFile(path.path).then(val => { |
|
|
|
this.imgList[this.imgList.length - 1].pathUrl = val |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 删除图片 |
|
|
|
@ -458,14 +486,22 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
var upImage = [] |
|
|
|
for(let i = 0;i < this.imgList.length;i++){ |
|
|
|
for (let i = 0; i < this.imgList.length; i++) { |
|
|
|
upImage.push(this.imgList[i].pathUrl) |
|
|
|
} |
|
|
|
for(let j = 0;j<this.skuList.length;j++){ |
|
|
|
if(this.skuList[j].isPromoting === 0){ |
|
|
|
this.skuList[j].isPromoting = true |
|
|
|
}else{ |
|
|
|
this.skuList[j].isPromoting = false |
|
|
|
} |
|
|
|
} |
|
|
|
var params = { |
|
|
|
...this.form, |
|
|
|
isMainProduct: this.form.isMainProductRep === 0 ? true : false, |
|
|
|
skuList: this.skuList, |
|
|
|
imgList:upImage, |
|
|
|
supplierId:this.$store.state.supplierInfo.supplierId |
|
|
|
imgList: upImage, |
|
|
|
supplierId: this.$store.state.supplierInfo.supplierId |
|
|
|
} |
|
|
|
if (this.eidtFor === 0) { |
|
|
|
createProduct(params).then(res => { |
|
|
|
|