|
@@ -12,7 +12,7 @@
|
|
|
class="selectlist"
|
|
|
mode="selector"
|
|
|
@change="changeStore"
|
|
|
- :value="0"
|
|
|
+ :value="storeIndex"
|
|
|
:range="storeList"
|
|
|
range-key="name"
|
|
|
>
|
|
@@ -173,6 +173,7 @@
|
|
|
class="ql-container"
|
|
|
:placeholder="placeholder"
|
|
|
@input="saveTxt"
|
|
|
+ @ready="onEditorReady"
|
|
|
></editor>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -228,13 +229,14 @@ export default {
|
|
|
|
|
|
// -------------- 编辑分界线 ------------------------------------
|
|
|
|
|
|
- shopData: uni.getStorageSync('shopData'), // 携带的编辑信息
|
|
|
-
|
|
|
+ SHOPID: 0,
|
|
|
+ shopData: {},
|
|
|
};
|
|
|
},
|
|
|
+ onUnload() {
|
|
|
+ uni.removeStorageSync('Id');
|
|
|
+ },
|
|
|
onLoad() {
|
|
|
- console.log('编辑');
|
|
|
- console.log(this.shopData);
|
|
|
// 初始化阿里云
|
|
|
myCloud = uniCloud.init({
|
|
|
provider: 'aliyun',
|
|
@@ -242,8 +244,73 @@ export default {
|
|
|
clientSecret: '8nOzV70edtpCd0El6qce3g==',
|
|
|
});
|
|
|
this.getShopList();
|
|
|
+
|
|
|
+ // ---------------------------------------------------
|
|
|
+ this.SHOPID = uni.getStorageSync('Id');
|
|
|
+ if (this.SHOPID) {
|
|
|
+ this.getShopBuyId();
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取单个商品信息
|
|
|
+ async getShopBuyId() {
|
|
|
+ if (!this.SHOPID) return;
|
|
|
+ await this.$http
|
|
|
+ .get('/goods/getById/' + this.SHOPID)
|
|
|
+ .then(async (res) => {
|
|
|
+ if (res.code === 200 && res.msg === 'OK') {
|
|
|
+ console.log(res);
|
|
|
+ this.shopData = res.data;
|
|
|
+
|
|
|
+ // 所属店铺回显
|
|
|
+ this.storeList.forEach((item, index) => {
|
|
|
+ if (this.shopData.shopId === item.id) {
|
|
|
+ this.storeIndex = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.storeId = this.storeList[this.storeIndex].id;
|
|
|
+
|
|
|
+ // 商品类型回显
|
|
|
+ this.getType();
|
|
|
+ this.getLine();
|
|
|
+
|
|
|
+ // 限制购票回显
|
|
|
+ if (this.shopData.saleRule === '1') {
|
|
|
+ let sale = JSON.parse(this.shopData.saleRuleJson);
|
|
|
+ this.showoperat = true;
|
|
|
+ this.num1 = sale.data.saleDay;
|
|
|
+ this.num2 = sale.data.saleNum;
|
|
|
+ } else {
|
|
|
+ this.showoperat = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 图标回显
|
|
|
+ if (this.shopData.icon) {
|
|
|
+ console.log('有图标');
|
|
|
+ this.iconurl = this.shopData.icon
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 所属店铺怎么回显???
|
|
|
+
|
|
|
+ // 初始化编辑器
|
|
|
+ onEditorReady() {
|
|
|
+ uni
|
|
|
+ .createSelectorQuery()
|
|
|
+ .select('#editor')
|
|
|
+ .context((res) => {
|
|
|
+ this.editorCtx = res.context;
|
|
|
+ this.editorCtx.setContents({
|
|
|
+ html: this.shopData.describ, //this.EditGoodsDetail.content为赋值内容。
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .exec();
|
|
|
+ },
|
|
|
+
|
|
|
+ // -----------------------------------------------------------------
|
|
|
+
|
|
|
// 跳转到管理分类页面
|
|
|
toClassify() {
|
|
|
if (this.storeId) {
|
|
@@ -257,7 +324,6 @@ export default {
|
|
|
changeStore(e) {
|
|
|
this.storeIndex = e.detail.value;
|
|
|
this.storeId = this.storeList[this.storeIndex].id;
|
|
|
-
|
|
|
// 未选择商铺不能进行商铺类型选择
|
|
|
if (this.storeId != '') {
|
|
|
this.getType();
|
|
@@ -312,6 +378,17 @@ export default {
|
|
|
arr.push({ name: element.name, id: element.id });
|
|
|
});
|
|
|
this.typeList = this.typeList.concat(arr);
|
|
|
+
|
|
|
+ // 商品类型回显
|
|
|
+ if (this.shopData.typeId) {
|
|
|
+ this.typeList.forEach((item, index) => {
|
|
|
+ if (this.shopData.typeId === item.id) {
|
|
|
+ this.typeIndex = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.typeId = this.typeList[this.typeIndex].id;
|
|
|
+ this.shopname = this.shopData.name;
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 商品名称
|
|
@@ -329,6 +406,7 @@ export default {
|
|
|
arr.push({ name: element.ticket_name, id: element.ticket_no });
|
|
|
});
|
|
|
this.shopList = this.shopList.concat(arr);
|
|
|
+ console.log(1);
|
|
|
console.log(this.shopList);
|
|
|
});
|
|
|
},
|
|
@@ -339,18 +417,39 @@ export default {
|
|
|
shopId: this.storeId,
|
|
|
})
|
|
|
.then(async (res) => {
|
|
|
- console.log(res);
|
|
|
let arr = [];
|
|
|
this.hasNameList = +res.data.shopFrom;
|
|
|
res.data.customGroupList.forEach((element) => {
|
|
|
arr.push({ name: element.name, id: element.id });
|
|
|
});
|
|
|
this.lineList = this.lineList.concat(arr);
|
|
|
+
|
|
|
+ // 可选择商品名称回显
|
|
|
+ if (this.shopData.name) {
|
|
|
+ this.getShopName();
|
|
|
+ this.shopList.forEach((item, index) => {
|
|
|
+ if (this.shopData.name === item.name) {
|
|
|
+ this.shopIndex = index;
|
|
|
+ } else {
|
|
|
+ this.shopIndex = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.shopId = this.shopList[this.shopIndex].id;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分类回显
|
|
|
+ if (this.shopData.customGroupId) {
|
|
|
+ this.lineList.forEach((item, index) => {
|
|
|
+ if (this.shopData.customGroupId === item.id) {
|
|
|
+ this.lineIndex = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.lineId = this.lineList[this.lineIndex].id;
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 账号限制
|
|
|
Change(e) {
|
|
|
- console.log(e);
|
|
|
this.showoperat = e.detail.value;
|
|
|
},
|
|
|
subtractUser() {
|
|
@@ -385,9 +484,6 @@ export default {
|
|
|
success: function (res) {
|
|
|
// 成功则返回图片的本地文件路径列表 tempFilePaths
|
|
|
_self.iconurl = res.tempFilePaths[0];
|
|
|
-
|
|
|
- console.log(_self.iconurl);
|
|
|
-
|
|
|
myCloud.uploadFile({
|
|
|
url: 'http://192.168.100.135:83/merch/common/upload/oss',
|
|
|
filePath: _self.iconurl, // 要上传的文件对象
|
|
@@ -398,12 +494,10 @@ export default {
|
|
|
let percentCompleted = Math.round(
|
|
|
(progressEvent.loaded * 100) / progressEvent.total
|
|
|
);
|
|
|
- console.log(percentCompleted);
|
|
|
},
|
|
|
success: (res) => {
|
|
|
if (res.fileID) {
|
|
|
_self.Icon = res.fileID;
|
|
|
- console.log(_self.Icon);
|
|
|
}
|
|
|
},
|
|
|
});
|
|
@@ -437,10 +531,8 @@ export default {
|
|
|
// let percentCompleted = Math.round(
|
|
|
// (progressEvent.loaded * 100) / progressEvent.total
|
|
|
// );
|
|
|
- // console.log(percentCompleted);
|
|
|
// },
|
|
|
// success: (res) => {
|
|
|
- // console.log(res);
|
|
|
// },
|
|
|
// });
|
|
|
// }
|
|
@@ -476,7 +568,7 @@ export default {
|
|
|
}
|
|
|
// 判断是否可以自定义商品名称
|
|
|
let name = '';
|
|
|
- if ((this.shopList.length = 1)) {
|
|
|
+ if ((this.shopList.length === 1)) {
|
|
|
name = this.shopname;
|
|
|
} else {
|
|
|
name = this.shopList[this.shopIndex].id;
|
|
@@ -496,7 +588,7 @@ export default {
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.$http
|
|
|
.post('/goods/add', {
|
|
|
mid: this.scenicId,
|
|
@@ -518,7 +610,8 @@ export default {
|
|
|
}, 500);
|
|
|
}
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|