|
|
@@ -229,9 +229,11 @@
|
|
|
<span>花材图片</span>
|
|
|
<span class="app-color-3">(建议比例 600X600)</span>
|
|
|
</div>
|
|
|
- <div class="module-det">
|
|
|
- <app-uploader ref="appUploader" @chooseImage="_uploadImg" :imgList.sync="form.cover" :prefixShow="true" :num="1" />
|
|
|
- </div>
|
|
|
+ <view class="module-det">
|
|
|
+ <htz-image-upload :max="1" :compress="true" v-model="currentImgData" :headers="headers"
|
|
|
+ @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" action="https://api.shop.hzghd.com/upload/save-file">
|
|
|
+ </htz-image-upload>
|
|
|
+ </view>
|
|
|
</div>
|
|
|
|
|
|
<div class="app-footer">
|
|
|
@@ -252,16 +254,19 @@ import { getAllItemClass } from "@/api/item-class";
|
|
|
import { getAllUnit } from "@/api/unit";
|
|
|
import { addProduct,updateProduct,getProductDetail,py } from "@/api/product";
|
|
|
import { getPtItemDetail } from "@/api/pt-item";
|
|
|
-
|
|
|
+//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
|
+import htzImageUpload from './components/htz-image-upload/htz-image-upload.vue'
|
|
|
export default {
|
|
|
name: "item-detail",
|
|
|
components: {
|
|
|
TuiListCell,
|
|
|
- AppUploader
|
|
|
+ AppUploader,
|
|
|
+ htzImageUpload
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
status: 1,
|
|
|
+ currentImgData: [],
|
|
|
form: {
|
|
|
id:0,
|
|
|
name:"",
|
|
|
@@ -290,7 +295,8 @@ export default {
|
|
|
smallUnitSelectedData:{},
|
|
|
bigUnitSelectedData:{},
|
|
|
hasRequest:0,
|
|
|
- productData:{id:0}
|
|
|
+ productData:{id:0},
|
|
|
+ headers:{token:''}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -299,6 +305,8 @@ export default {
|
|
|
if(option.id){
|
|
|
this.form.id = this.option.id
|
|
|
}
|
|
|
+ const token = uni.getStorageSync('token')
|
|
|
+ this.headers.token = token
|
|
|
},
|
|
|
watch:{
|
|
|
},
|
|
|
@@ -332,9 +340,6 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- _uploadImg(val) {
|
|
|
- this.form.cover = val;
|
|
|
- },
|
|
|
goBack(){
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
|
@@ -363,7 +368,9 @@ export default {
|
|
|
this.form[i] = res.data[i];
|
|
|
});
|
|
|
|
|
|
+ this.currentImgData.push(res.data.cover)
|
|
|
this.form.cover = [res.data.shortCover]
|
|
|
+
|
|
|
this.form.stock = ''
|
|
|
this.form.itemId = ptItemId
|
|
|
this.form.classId = ''
|
|
|
@@ -387,9 +394,11 @@ export default {
|
|
|
this.form[i] = res.data[i];
|
|
|
});
|
|
|
|
|
|
- this.form.price = res.data.prePrice
|
|
|
+ this.currentImgData.push(res.data.cover)
|
|
|
this.form.cover = [res.data.shortCover]
|
|
|
|
|
|
+ this.form.price = res.data.prePrice
|
|
|
+
|
|
|
this.itemClassSelectedData = this.itemClassData.filter(
|
|
|
e => this.form.classId == e.id
|
|
|
)[0];
|
|
|
@@ -399,11 +408,20 @@ export default {
|
|
|
this.bigUnitSelectedData = this.unitData.filter(
|
|
|
e => this.form.bigUnitId == e.id
|
|
|
)[0];
|
|
|
-
|
|
|
this.productData = res.data
|
|
|
-
|
|
|
});
|
|
|
},
|
|
|
+ imgUploadSuccess(res) {
|
|
|
+ var _res = JSON.parse(res.data)
|
|
|
+ if(_res.code == 1){
|
|
|
+ this.currentImgData.push(_res.data.smallUrl)
|
|
|
+ this.form.cover.push(_res.data.shortUrl)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ imgDeleteFn(res){
|
|
|
+ const index = res.index
|
|
|
+ this.form.cover.splice(index,1)
|
|
|
+ },
|
|
|
init() {
|
|
|
|
|
|
//从平台导入花材
|