|
@@ -1,7 +1,5 @@
|
|
|
<template>
|
|
|
<view class="shopdetail">
|
|
|
- <!-- <Header :title="title"></Header>
|
|
|
- <view class="" style="height: 94upx;"></view> -->
|
|
|
<view class="shopdetail-content">
|
|
|
<!-- 所属店铺 -->
|
|
|
<view class="shop detail-list">
|
|
@@ -30,7 +28,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 商品类型 -->
|
|
|
- <view class="shoptype detail-list noborder">
|
|
|
+ <view class="shoptype detail-list ">
|
|
|
<view class="menu">
|
|
|
<view class="uni-list-cell">
|
|
|
<view class="uni-list-cell-db">
|
|
@@ -56,7 +54,8 @@
|
|
|
</view>
|
|
|
<!-- 商品名称 -->
|
|
|
<view class="shopname detail-list">
|
|
|
- <view class="menu" v-if="hasNameList === 1">
|
|
|
+ <!-- <view class="menu" v-if="hasNameList === 1"> -->
|
|
|
+ <view class="menu" v-if="typeProperty === '1'">
|
|
|
<view class="uni-list-cell">
|
|
|
<view class="uni-list-cell-db">
|
|
|
<picker
|
|
@@ -77,7 +76,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="menu" v-if="hasNameList === 0">
|
|
|
+ <!-- <view class="menu" v-if="hasNameList === 0"> -->
|
|
|
+ <view class="menu" v-if="typeProperty === '0'">
|
|
|
<input
|
|
|
class="input-shopname"
|
|
|
type="text"
|
|
@@ -338,7 +338,6 @@
|
|
|
></editor>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
<view class="btn" @tap="submitMesage">确认</view>
|
|
|
<rf-loading v-if="loading"></rf-loading>
|
|
|
<uni-calendar
|
|
@@ -353,6 +352,7 @@
|
|
|
|
|
|
<script>
|
|
|
let myCloud;
|
|
|
+let shopData;
|
|
|
import Header from '../components/header.vue';
|
|
|
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
|
|
|
import moment from '@/common/moment';
|
|
@@ -408,7 +408,7 @@ export default {
|
|
|
// -------------- 编辑分界线 ------------------------------------
|
|
|
|
|
|
SHOPID: 0,
|
|
|
- shopData: {},
|
|
|
+ // shopData: {},
|
|
|
|
|
|
expirationDate: '请选择商品过期日期',
|
|
|
// 销售属性
|
|
@@ -463,8 +463,8 @@ export default {
|
|
|
goodsStockFlag: '0', // 库存模式
|
|
|
bookRule: '', // 同一天限购
|
|
|
usubscribeRule: '0', // 可退规则
|
|
|
- isRealName: '', // 开启实名制
|
|
|
- isShowQrcode: '', // 显示二维码
|
|
|
+ isRealName: '1', // 开启实名制
|
|
|
+ isShowQrcode: '1', // 显示二维码
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -485,14 +485,16 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.getShopList();
|
|
|
|
|
|
- // ---------------------------------------------------
|
|
|
this.SHOPID = uni.getStorageSync('Id');
|
|
|
if (this.SHOPID) {
|
|
|
this.getShopBuyId();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ this.getShopList();
|
|
|
+ this.getType();
|
|
|
+ this.getShopName();
|
|
|
+ this.getLine();
|
|
|
},
|
|
|
methods: {
|
|
|
// 打开日历
|
|
@@ -503,7 +505,7 @@ export default {
|
|
|
this.expirationDate = e.fulldate;
|
|
|
},
|
|
|
// 单选自定义属性
|
|
|
- radioChange: function (evt) {
|
|
|
+ radioChange (evt) {
|
|
|
for (let i = 0; i < this.patterList.length; i++) {
|
|
|
if (this.patterList[i].id === evt.target.value) {
|
|
|
this.patterIndex = i;
|
|
@@ -556,30 +558,29 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 获取单个商品信息
|
|
|
- async getShopBuyId() {
|
|
|
+ getShopBuyId() {
|
|
|
this.loading = true;
|
|
|
if (!this.SHOPID) return;
|
|
|
- await this.$http
|
|
|
+ this.$http
|
|
|
.get('/goods/getById/' + this.SHOPID)
|
|
|
- .then(async (res) => {
|
|
|
+ .then((res) => {
|
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
|
- this.shopData = res.data;
|
|
|
- console.log(this.shopData);
|
|
|
|
|
|
- this.getShopList();
|
|
|
+ shopData = res.data;
|
|
|
+ console.log(shopData);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
// 判断返回的是否是自营商品
|
|
|
- this.price = this.shopData.salePrice / 100;
|
|
|
- this.rateprice = this.shopData.price / 100;
|
|
|
+ this.price = shopData.salePrice / 100;
|
|
|
+ this.rateprice = shopData.price / 100;
|
|
|
|
|
|
- if (this.shopData.expiredTime) {
|
|
|
- this.expirationDate = this.shopData.expiredTime.slice(0, 10)
|
|
|
- ? this.shopData.expiredTime.slice(0, 10)
|
|
|
+ if (shopData.expiredTime) {
|
|
|
+ this.expirationDate = shopData.expiredTime.slice(0, 10)
|
|
|
+ ? shopData.expiredTime.slice(0, 10)
|
|
|
: '请选择商品过期日期';
|
|
|
}
|
|
|
|
|
|
- let rule = JSON.parse(this.shopData.saleRuleJson);
|
|
|
+ let rule = JSON.parse(shopData.saleRuleJson);
|
|
|
|
|
|
if (rule) {
|
|
|
this.astrictDate.data.saleDay = rule.data.saleDay
|
|
@@ -595,9 +596,9 @@ export default {
|
|
|
this.astrictDate.goodsStockFlag = rule.data.goodsStockFlag;
|
|
|
this.shopNumIndex = +rule.data.goodsStockFlag;
|
|
|
if (this.shopNumIndex === 1) {
|
|
|
- this.dateInventory = this.shopData.inventory;
|
|
|
+ this.dateInventory = shopData.inventory;
|
|
|
} else if (this.shopNumIndex === 2) {
|
|
|
- this.sunInventory = this.shopData.inventory;
|
|
|
+ this.sunInventory = shopData.inventory;
|
|
|
}
|
|
|
// 预订数量
|
|
|
this.astrictDate.data.bookRule = rule.data.bookRule;
|
|
@@ -620,15 +621,15 @@ export default {
|
|
|
this.astrictDate.data.isShowQrcode = rule.data.isShowQrcode;
|
|
|
}
|
|
|
// 限制购票回显
|
|
|
- if (this.shopData.saleRule === '1') {
|
|
|
+ if (shopData.saleRule === '1') {
|
|
|
this.showoperat = true;
|
|
|
} else {
|
|
|
this.showoperat = false;
|
|
|
}
|
|
|
|
|
|
// 图标回显
|
|
|
- if (this.shopData.icon) {
|
|
|
- this.iconurl = this.shopData.icon;
|
|
|
+ if (shopData.icon) {
|
|
|
+ this.iconurl = shopData.icon;
|
|
|
} else {
|
|
|
this.iconurl = '';
|
|
|
}
|
|
@@ -646,7 +647,7 @@ export default {
|
|
|
.context((res) => {
|
|
|
this.editorCtx = res.context;
|
|
|
this.editorCtx.setContents({
|
|
|
- html: this.shopData.describ, //this.EditGoodsDetail.content为赋值内容。
|
|
|
+ html: shopData.describ, //this.EditGoodsDetail.content为赋值内容。
|
|
|
});
|
|
|
})
|
|
|
.exec();
|
|
@@ -668,19 +669,11 @@ export default {
|
|
|
this.storeIndex = e.detail.value;
|
|
|
this.storeId = this.storeList[this.storeIndex].id;
|
|
|
this.typeProperty = this.storeList[this.storeIndex].type;
|
|
|
- // 未选择商铺不能进行商铺类型选择
|
|
|
- if (this.storeId != '') {
|
|
|
- this.getType();
|
|
|
- this.getLine(); // 判断是否有商品名称列表
|
|
|
- }
|
|
|
},
|
|
|
// 选择商品类型
|
|
|
changeType(e) {
|
|
|
this.typeIndex = e.detail.value;
|
|
|
this.typeId = this.typeList[this.typeIndex].id;
|
|
|
- if (this.typeId != '') {
|
|
|
- this.getShopName();
|
|
|
- }
|
|
|
},
|
|
|
// 商品名称选择
|
|
|
changeShop(e) {
|
|
@@ -706,25 +699,22 @@ export default {
|
|
|
arr.push({
|
|
|
name: element.name,
|
|
|
id: element.id,
|
|
|
- type: element.shopFrom,
|
|
|
+ type: element.shopFrom // 是否是分销店铺
|
|
|
});
|
|
|
});
|
|
|
this.storeList = this.storeList.concat(arr);
|
|
|
this.storeDisable = false;
|
|
|
+
|
|
|
// 所属店铺回显
|
|
|
- if (this.shopData.shopId) {
|
|
|
+ if (shopData.shopId) {
|
|
|
this.storeDisable = true;
|
|
|
this.storeList.forEach((item, index) => {
|
|
|
- if (this.shopData.shopId === item.id) {
|
|
|
+ if (shopData.shopId === item.id) {
|
|
|
this.storeIndex = index;
|
|
|
}
|
|
|
});
|
|
|
this.storeId = this.storeList[this.storeIndex].id;
|
|
|
this.typeProperty = this.storeList[this.storeIndex].type;
|
|
|
-
|
|
|
- // 商品类型回显
|
|
|
- this.getType();
|
|
|
- this.getLine();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -732,58 +722,58 @@ export default {
|
|
|
// 商品类型
|
|
|
async getType() {
|
|
|
this.typeList = [{ name: '商品类型(请先选择所属店铺)', id: '' }];
|
|
|
- this.$http
|
|
|
- .get('/type/getTypeListByShopId', {
|
|
|
- id: this.storeId,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- let arr = [];
|
|
|
- res.data[0].children.forEach((element) => {
|
|
|
- arr.push({ name: element.name, id: element.id });
|
|
|
- });
|
|
|
- this.typeList = this.typeList.concat(arr);
|
|
|
- this.typeDisabled = false;
|
|
|
-
|
|
|
- // 商品类型回显
|
|
|
- if (this.shopData.typeId) {
|
|
|
- this.typeDisabled = true;
|
|
|
-
|
|
|
- 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;
|
|
|
- }
|
|
|
+ this.$http.get('/type/getTypeListByShopId', {
|
|
|
+ id: this.storeId || shopData.shopId
|
|
|
+ }).then((res) => {
|
|
|
+ let arr = [];
|
|
|
+ res.data[0].children.forEach((element) => {
|
|
|
+ arr.push({ name: element.name, id: element.id });
|
|
|
});
|
|
|
+ this.typeList = this.typeList.concat(arr);
|
|
|
+ this.typeDisabled = false;
|
|
|
+
|
|
|
+ // 商品类型回显
|
|
|
+ if (shopData.typeId) {
|
|
|
+ this.typeDisabled = true;
|
|
|
+ this.typeList.forEach((item, index) => {
|
|
|
+ if (shopData.typeId === item.id) {
|
|
|
+ this.typeIndex = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.typeId = this.typeList[this.typeIndex].id;
|
|
|
+ this.shopname = shopData.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 商品名称
|
|
|
async getShopName() {
|
|
|
this.shopList = [{ name: '商品名称(请先选择商品类型)', id: '' }];
|
|
|
await this.$http
|
|
|
.get('/goods/getTicketGoods', {
|
|
|
- typeId: this.typeId,
|
|
|
- shopId: this.storeId,
|
|
|
+ typeId: this.typeId || shopData.typeId,
|
|
|
+ shopId: this.storeId || shopData.shopId
|
|
|
})
|
|
|
.then(async (res) => {
|
|
|
- let arr = [];
|
|
|
- res.data.forEach((element) => {
|
|
|
- arr.push({ name: element.ticket_name, id: element.ticket_no });
|
|
|
- });
|
|
|
- this.shopList = this.shopList.concat(arr);
|
|
|
-
|
|
|
- // 回显名称
|
|
|
- if (this.shopData.name) {
|
|
|
- this.shopList.forEach((item, index) => {
|
|
|
- if (this.shopData.name === item.name) {
|
|
|
- this.shopIndex = index;
|
|
|
- } else {
|
|
|
- this.shopIndex = 0
|
|
|
- this.shopList[0].name = this.shopData.name
|
|
|
- }
|
|
|
+ if (res.code === 200) {
|
|
|
+ let arr = [];
|
|
|
+ res.data.forEach((element) => {
|
|
|
+ arr.push({ name: element.ticket_name, id: element.ticket_no });
|
|
|
});
|
|
|
- this.shopId = this.shopList[this.shopIndex].id;
|
|
|
+ this.shopList = this.shopList.concat(arr);
|
|
|
+
|
|
|
+ // 回显名称
|
|
|
+ if (shopData.name) {
|
|
|
+ this.shopList[0] = {name: shopData.name,id: shopData.ticketNo}
|
|
|
+ this.shopList.forEach((item, index) => {
|
|
|
+ if (shopData.name === item.name) {
|
|
|
+ // this.shopList[0] = { name: '商品名称(请先选择商品类型)', id: '' }
|
|
|
+ this.shopIndex = index;
|
|
|
+ } else {
|
|
|
+ this.shopIndex = 0
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.shopId = this.shopList[this.shopIndex].id;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -792,26 +782,21 @@ export default {
|
|
|
this.lineList = [{ name: '分类(请先选择所属商品)', id: '' }];
|
|
|
await this.$http
|
|
|
.get('/goods/getCustomGroupList', {
|
|
|
- shopId: this.storeId,
|
|
|
+ shopId: this.storeId || shopData.shopId,
|
|
|
})
|
|
|
.then(async (res) => {
|
|
|
let arr = [];
|
|
|
- this.hasNameList = +res.data.shopFrom;
|
|
|
+ this.typeProperty = +res.data.shopFrom;
|
|
|
res.data.customGroupList.forEach((element) => {
|
|
|
arr.push({ name: element.name, id: element.id });
|
|
|
});
|
|
|
this.lineList = this.lineList.concat(arr);
|
|
|
this.lineDidsable = false;
|
|
|
|
|
|
- // 可选择商品名称回显
|
|
|
- if (this.shopData.name) {
|
|
|
- this.getShopName();
|
|
|
- }
|
|
|
-
|
|
|
// 分类回显
|
|
|
- if (this.shopData.customGroupId) {
|
|
|
+ if (shopData.customGroupId) {
|
|
|
this.lineList.forEach((item, index) => {
|
|
|
- if (this.shopData.customGroupId === item.id) {
|
|
|
+ if (shopData.customGroupId === item.id) {
|
|
|
this.lineIndex = index;
|
|
|
}
|
|
|
});
|
|
@@ -868,7 +853,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
fail: function (msg) {
|
|
|
- console.log(msg);
|
|
|
},
|
|
|
onUploadProgress: function (progressEvent) {
|
|
|
_self.progress = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
|
@@ -879,7 +863,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
fail: function (error) {
|
|
|
- console.log(error);
|
|
|
_self.uploadtxt = '已取消上传'
|
|
|
}
|
|
|
});
|
|
@@ -939,19 +922,14 @@ export default {
|
|
|
this.astrictDate.data.saleDay = 0;
|
|
|
this.astrictDate.data.saleNum = 0;
|
|
|
}
|
|
|
- // 判断是否可以自定义商品名称
|
|
|
+
|
|
|
let name = '';
|
|
|
- console.log(this.shopList.length);
|
|
|
- if (this.shopList.length === 1) {
|
|
|
+ if (this.typeProperty === '1' ) {
|
|
|
+ name = this.shopList[this.shopIndex].id
|
|
|
+ } else if (this.typeProperty === '0') {
|
|
|
name = this.shopname;
|
|
|
}
|
|
|
- else {
|
|
|
- if (this.shopList[0].name != '商品名称(请先选择商品类型)') {
|
|
|
- name = this.shopList[this.shopIndex].name;
|
|
|
- } else {
|
|
|
- name = this.shopList[this.shopIndex].id;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if (!this.storeId) {
|
|
|
this.$mHelper.toast('请选择所属商铺!');
|
|
|
return;
|
|
@@ -1008,15 +986,15 @@ export default {
|
|
|
this.loading = true;
|
|
|
this.$http
|
|
|
.post('/goods/add', {
|
|
|
- id: this.shopData.id || '',
|
|
|
+ id: shopData.id || '',
|
|
|
mid: this.scenicId,
|
|
|
shopId: this.storeId,
|
|
|
typeId: this.typeId,
|
|
|
customGroupId: this.lineId,
|
|
|
describ: this.mastKnow,
|
|
|
icon: this.Icon || '',
|
|
|
- del: this.shopData.del || '',
|
|
|
- upDown: this.shopData.upDown || '',
|
|
|
+ del: shopData.del || '',
|
|
|
+ upDown: shopData.upDown || '',
|
|
|
saleRule: this.showoperat, // 限制购票
|
|
|
saleRuleJson: JSON.stringify(this.astrictDate),
|
|
|
// 自营
|
|
@@ -1029,7 +1007,7 @@ export default {
|
|
|
.then((res) => {
|
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
|
this.loading = false;
|
|
|
- if (this.shopData.id) {
|
|
|
+ if (shopData.id) {
|
|
|
this.$mHelper.toast('保存成功,请联系管理员进行审核');
|
|
|
} else {
|
|
|
this.$mHelper.toast('添加成功');
|