|
@@ -28,7 +28,7 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 商品类型 -->
|
|
<!-- 商品类型 -->
|
|
- <view class="shoptype detail-list ">
|
|
|
|
|
|
+ <view class="shoptype detail-list">
|
|
<view class="menu">
|
|
<view class="menu">
|
|
<view class="uni-list-cell">
|
|
<view class="uni-list-cell">
|
|
<view class="uni-list-cell-db">
|
|
<view class="uni-list-cell-db">
|
|
@@ -301,7 +301,10 @@
|
|
<view class="iconcontent">
|
|
<view class="iconcontent">
|
|
<image class="shopLogo" :src="iconurl" v-if="iconurl"></image>
|
|
<image class="shopLogo" :src="iconurl" v-if="iconurl"></image>
|
|
<text class="icon" @tap="uploadImg">点击上传</text>
|
|
<text class="icon" @tap="uploadImg">点击上传</text>
|
|
- <text class="per">{{ uploadtxt }} {{ progress=== 0 ? '' : progress }} <text v-if="progress!=0">%</text></text>
|
|
|
|
|
|
+ <text class="per"
|
|
|
|
+ >{{ uploadtxt }} {{ progress === 0 ? '' : progress }}
|
|
|
|
+ <text v-if="progress != 0">%</text></text
|
|
|
|
+ >
|
|
</view>
|
|
</view>
|
|
<view class="shopicon">商品图册</view>
|
|
<view class="shopicon">商品图册</view>
|
|
<view class="uploading">
|
|
<view class="uploading">
|
|
@@ -352,7 +355,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
let myCloud;
|
|
let myCloud;
|
|
-let shopData;
|
|
|
|
|
|
+let _self;
|
|
import Header from '../components/header.vue';
|
|
import Header from '../components/header.vue';
|
|
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
|
|
import uniCalendar from '@/components/uni-calendar/uni-calendar.vue';
|
|
import moment from '@/common/moment';
|
|
import moment from '@/common/moment';
|
|
@@ -379,7 +382,7 @@ export default {
|
|
|
|
|
|
typeList: [{ name: '商品类型(请先选择所属店铺)', id: '' }],
|
|
typeList: [{ name: '商品类型(请先选择所属店铺)', id: '' }],
|
|
typeIndex: 0,
|
|
typeIndex: 0,
|
|
- typeId: '',
|
|
|
|
|
|
+ typeId: '1',
|
|
typeDisabled: true,
|
|
typeDisabled: true,
|
|
|
|
|
|
shopList: [{ name: '商品名称(请先选择商品类型)', id: '' }],
|
|
shopList: [{ name: '商品名称(请先选择商品类型)', id: '' }],
|
|
@@ -408,7 +411,7 @@ export default {
|
|
// -------------- 编辑分界线 ------------------------------------
|
|
// -------------- 编辑分界线 ------------------------------------
|
|
|
|
|
|
SHOPID: 0,
|
|
SHOPID: 0,
|
|
- // shopData: {},
|
|
|
|
|
|
+ shopData: {},
|
|
|
|
|
|
expirationDate: '请选择商品过期日期',
|
|
expirationDate: '请选择商品过期日期',
|
|
// 销售属性
|
|
// 销售属性
|
|
@@ -473,11 +476,11 @@ export default {
|
|
uni.removeStorageSync('Id');
|
|
uni.removeStorageSync('Id');
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- if (this.storeId != '') {
|
|
|
|
- this.getLine()
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.storeId != '') {
|
|
|
|
+ // this.getLine(this.storeId)
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
- onReady (){
|
|
|
|
|
|
+ onReady() {
|
|
myCloud = uniCloud.init({
|
|
myCloud = uniCloud.init({
|
|
provider: 'aliyun',
|
|
provider: 'aliyun',
|
|
spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
|
|
spaceId: 'db8671a1-69bd-470d-ad59-ba927c88f4a4',
|
|
@@ -485,18 +488,165 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
-
|
|
|
|
this.SHOPID = uni.getStorageSync('Id');
|
|
this.SHOPID = uni.getStorageSync('Id');
|
|
|
|
+
|
|
if (this.SHOPID) {
|
|
if (this.SHOPID) {
|
|
- this.getShopBuyId();
|
|
|
|
|
|
+ this.getShopBuyId(this.SHOPID).then( () => {
|
|
|
|
+ this.getShopList().then(()=>{
|
|
|
|
+ this.getShopName(this.typeId, this.storeId);
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ // 判断返回的是否是自营商品
|
|
|
|
+ this.price = this.shopData.salePrice / 100;
|
|
|
|
+ this.rateprice = this.shopData.price / 100;
|
|
|
|
+
|
|
|
|
+ if (this.shopData.expiredTime) {
|
|
|
|
+ this.expirationDate = this.shopData.expiredTime.slice(0, 10)
|
|
|
|
+ ? this.shopData.expiredTime.slice(0, 10)
|
|
|
|
+ : '请选择商品过期日期';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let rule = JSON.parse(this.shopData.saleRuleJson);
|
|
|
|
+
|
|
|
|
+ if (rule) {
|
|
|
|
+ this.astrictDate.data.saleDay = rule.data.saleDay
|
|
|
|
+ ? rule.data.saleDay
|
|
|
|
+ : 0;
|
|
|
|
+ this.astrictDate.data.saleNum = rule.data.saleNum
|
|
|
|
+ ? rule.data.saleNum
|
|
|
|
+ : 0;
|
|
|
|
+ // 有效期模式
|
|
|
|
+ this.astrictDate.dateSetting = rule.data.dateSetting;
|
|
|
|
+ this.patterIndex = +rule.data.dateSetting;
|
|
|
|
+ // 库存模式
|
|
|
|
+ this.astrictDate.goodsStockFlag = rule.data.goodsStockFlag;
|
|
|
|
+ this.shopNumIndex = +rule.data.goodsStockFlag;
|
|
|
|
+
|
|
|
|
+ if (this.shopNumIndex === 1) {
|
|
|
|
+ this.dateInventory = this.shopData.inventory;
|
|
|
|
+ } else if (this.shopNumIndex === 2) {
|
|
|
|
+ this.sunInventory = this.shopData.inventory;
|
|
|
|
+ }
|
|
|
|
+ // 预订数量
|
|
|
|
+ this.astrictDate.data.bookRule = rule.data.bookRule;
|
|
|
|
+ // 实名制
|
|
|
|
+ if (rule.data.isRealName === '0') {
|
|
|
|
+ this.trueNme = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.trueNme = false;
|
|
|
|
+ }
|
|
|
|
+ this.astrictDate.data.isRealName = rule.data.isRealName;
|
|
|
|
+ // 可退规则
|
|
|
|
+ this.bookingIndex = +rule.data.usubscribeRule;
|
|
|
|
+ this.astrictDate.usubscribeRule = rule.data.usubscribeRule;
|
|
|
|
+ // 二维码
|
|
|
|
+ if (rule.data.isShowQrcode === '0') {
|
|
|
|
+ this.codeShow = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.codeShow = false;
|
|
|
|
+ }
|
|
|
|
+ this.astrictDate.data.isShowQrcode = rule.data.isShowQrcode;
|
|
|
|
+ }
|
|
|
|
+ // 限制购票回显
|
|
|
|
+ if (this.shopData.saleRule === '1') {
|
|
|
|
+ this.showoperat = true;
|
|
|
|
+ } else {
|
|
|
|
+ this.showoperat = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 图标回显
|
|
|
|
+ if (this.shopData.icon) {
|
|
|
|
+ this.iconurl = this.shopData.icon;
|
|
|
|
+ } else {
|
|
|
|
+ this.iconurl = '';
|
|
|
|
+ }
|
|
|
|
+ this.loading = false;
|
|
|
|
+ }, 1);
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
- this.getShopList();
|
|
|
|
- this.getType();
|
|
|
|
- this.getShopName();
|
|
|
|
- this.getLine();
|
|
|
|
|
|
+ // this.getShopList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 获取单个商品信息
|
|
|
|
+ async getShopBuyId(id) {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ await this.$http.get('/goods/getById/' + id).then((res) => {
|
|
|
|
+ if (res.code === 200 && res.msg === 'OK') {
|
|
|
|
+ this.shopData = res.data;
|
|
|
|
+ this.storeId = res.data.shopId;
|
|
|
|
+ this.typeId = res.data.typeId;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // this.price = this.shopData.salePrice / 100;
|
|
|
|
+ // this.rateprice = this.shopData.price / 100;
|
|
|
|
+
|
|
|
|
+ // if (this.shopData.expiredTime) {
|
|
|
|
+ // this.expirationDate = this.shopData.expiredTime.slice(0, 10)
|
|
|
|
+ // ? this.shopData.expiredTime.slice(0, 10)
|
|
|
|
+ // : '请选择商品过期日期';
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // let rule = JSON.parse(this.shopData.saleRuleJson);
|
|
|
|
+
|
|
|
|
+ // if (rule) {
|
|
|
|
+ // this.astrictDate.data.saleDay = rule.data.saleDay
|
|
|
|
+ // ? rule.data.saleDay
|
|
|
|
+ // : 0;
|
|
|
|
+ // this.astrictDate.data.saleNum = rule.data.saleNum
|
|
|
|
+ // ? rule.data.saleNum
|
|
|
|
+ // : 0;
|
|
|
|
+ // // 有效期模式
|
|
|
|
+ // this.astrictDate.dateSetting = rule.data.dateSetting;
|
|
|
|
+ // this.patterIndex = +rule.data.dateSetting;
|
|
|
|
+ // // 库存模式
|
|
|
|
+ // this.astrictDate.goodsStockFlag = rule.data.goodsStockFlag;
|
|
|
|
+ // this.shopNumIndex = +rule.data.goodsStockFlag;
|
|
|
|
+
|
|
|
|
+ // if (this.shopNumIndex === 1) {
|
|
|
|
+ // this.dateInventory = this.shopData.inventory;
|
|
|
|
+ // } else if (this.shopNumIndex === 2) {
|
|
|
|
+ // this.sunInventory = this.shopData.inventory;
|
|
|
|
+ // }
|
|
|
|
+ // // 预订数量
|
|
|
|
+ // this.astrictDate.data.bookRule = rule.data.bookRule;
|
|
|
|
+ // // 实名制
|
|
|
|
+ // if (rule.data.isRealName === '0') {
|
|
|
|
+ // this.trueNme = true;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.trueNme = false;
|
|
|
|
+ // }
|
|
|
|
+ // this.astrictDate.data.isRealName = rule.data.isRealName;
|
|
|
|
+ // // 可退规则
|
|
|
|
+ // this.bookingIndex = +rule.data.usubscribeRule;
|
|
|
|
+ // this.astrictDate.usubscribeRule = rule.data.usubscribeRule;
|
|
|
|
+ // // 二维码
|
|
|
|
+ // if (rule.data.isShowQrcode === '0') {
|
|
|
|
+ // this.codeShow = true;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.codeShow = false;
|
|
|
|
+ // }
|
|
|
|
+ // this.astrictDate.data.isShowQrcode = rule.data.isShowQrcode;
|
|
|
|
+ // }
|
|
|
|
+ // // 限制购票回显
|
|
|
|
+ // if (this.shopData.saleRule === '1') {
|
|
|
|
+ // this.showoperat = true;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.showoperat = false;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // // 图标回显
|
|
|
|
+ // if (this.shopData.icon) {
|
|
|
|
+ // this.iconurl = this.shopData.icon;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.iconurl = '';
|
|
|
|
+ // }
|
|
|
|
+ // this.loading = false;
|
|
|
|
+ // }, 500);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
// 打开日历
|
|
// 打开日历
|
|
openTime() {
|
|
openTime() {
|
|
this.$refs.calendar.open();
|
|
this.$refs.calendar.open();
|
|
@@ -504,8 +654,8 @@ export default {
|
|
confirm(e) {
|
|
confirm(e) {
|
|
this.expirationDate = e.fulldate;
|
|
this.expirationDate = e.fulldate;
|
|
},
|
|
},
|
|
- // 单选自定义属性
|
|
|
|
- radioChange (evt) {
|
|
|
|
|
|
+ // 自定义属性
|
|
|
|
+ radioChange(evt) {
|
|
for (let i = 0; i < this.patterList.length; i++) {
|
|
for (let i = 0; i < this.patterList.length; i++) {
|
|
if (this.patterList[i].id === evt.target.value) {
|
|
if (this.patterList[i].id === evt.target.value) {
|
|
this.patterIndex = i;
|
|
this.patterIndex = i;
|
|
@@ -514,7 +664,7 @@ export default {
|
|
}
|
|
}
|
|
this.astrictDate.data.dateSetting = evt.detail.value;
|
|
this.astrictDate.data.dateSetting = evt.detail.value;
|
|
},
|
|
},
|
|
- // 单选库存模式
|
|
|
|
|
|
+ // 库存模式
|
|
shopNumChange(e) {
|
|
shopNumChange(e) {
|
|
for (let i = 0; i < this.shopNumList.length; i++) {
|
|
for (let i = 0; i < this.shopNumList.length; i++) {
|
|
if (this.shopNumList[i].id === e.target.value) {
|
|
if (this.shopNumList[i].id === e.target.value) {
|
|
@@ -531,7 +681,7 @@ export default {
|
|
}
|
|
}
|
|
this.astrictDate.data.goodsStockFlag = e.detail.value;
|
|
this.astrictDate.data.goodsStockFlag = e.detail.value;
|
|
},
|
|
},
|
|
- // 单选可退模式
|
|
|
|
|
|
+ // 可退模式
|
|
bookingChange(e) {
|
|
bookingChange(e) {
|
|
for (let i = 0; i < this.bookingList.length; i++) {
|
|
for (let i = 0; i < this.bookingList.length; i++) {
|
|
if (this.bookingList[i].id === e.target.value) {
|
|
if (this.bookingList[i].id === e.target.value) {
|
|
@@ -557,88 +707,6 @@ export default {
|
|
this.astrictDate.data.isShowQrcode = '1';
|
|
this.astrictDate.data.isShowQrcode = '1';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 获取单个商品信息
|
|
|
|
- getShopBuyId() {
|
|
|
|
- this.loading = true;
|
|
|
|
- if (!this.SHOPID) return;
|
|
|
|
- this.$http
|
|
|
|
- .get('/goods/getById/' + this.SHOPID)
|
|
|
|
- .then((res) => {
|
|
|
|
- if (res.code === 200 && res.msg === 'OK') {
|
|
|
|
-
|
|
|
|
- shopData = res.data;
|
|
|
|
- console.log(shopData);
|
|
|
|
-
|
|
|
|
- setTimeout(() => {
|
|
|
|
- // 判断返回的是否是自营商品
|
|
|
|
- this.price = shopData.salePrice / 100;
|
|
|
|
- this.rateprice = shopData.price / 100;
|
|
|
|
-
|
|
|
|
- if (shopData.expiredTime) {
|
|
|
|
- this.expirationDate = shopData.expiredTime.slice(0, 10)
|
|
|
|
- ? shopData.expiredTime.slice(0, 10)
|
|
|
|
- : '请选择商品过期日期';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let rule = JSON.parse(shopData.saleRuleJson);
|
|
|
|
-
|
|
|
|
- if (rule) {
|
|
|
|
- this.astrictDate.data.saleDay = rule.data.saleDay
|
|
|
|
- ? rule.data.saleDay
|
|
|
|
- : 0;
|
|
|
|
- this.astrictDate.data.saleNum = rule.data.saleNum
|
|
|
|
- ? rule.data.saleNum
|
|
|
|
- : 0;
|
|
|
|
- // 有效期模式
|
|
|
|
- this.astrictDate.dateSetting = rule.data.dateSetting;
|
|
|
|
- this.patterIndex = +rule.data.dateSetting;
|
|
|
|
- // 库存模式
|
|
|
|
- this.astrictDate.goodsStockFlag = rule.data.goodsStockFlag;
|
|
|
|
- this.shopNumIndex = +rule.data.goodsStockFlag;
|
|
|
|
- if (this.shopNumIndex === 1) {
|
|
|
|
- this.dateInventory = shopData.inventory;
|
|
|
|
- } else if (this.shopNumIndex === 2) {
|
|
|
|
- this.sunInventory = shopData.inventory;
|
|
|
|
- }
|
|
|
|
- // 预订数量
|
|
|
|
- this.astrictDate.data.bookRule = rule.data.bookRule;
|
|
|
|
- // 实名制
|
|
|
|
- if (rule.data.isRealName === '0') {
|
|
|
|
- this.trueNme = true;
|
|
|
|
- } else {
|
|
|
|
- this.trueNme = false;
|
|
|
|
- }
|
|
|
|
- this.astrictDate.data.isRealName = rule.data.isRealName;
|
|
|
|
- // 可退规则
|
|
|
|
- this.bookingIndex = +rule.data.usubscribeRule;
|
|
|
|
- this.astrictDate.usubscribeRule = rule.data.usubscribeRule;
|
|
|
|
- // 二维码
|
|
|
|
- if (rule.data.isShowQrcode === '0') {
|
|
|
|
- this.codeShow = true;
|
|
|
|
- } else {
|
|
|
|
- this.codeShow = false;
|
|
|
|
- }
|
|
|
|
- this.astrictDate.data.isShowQrcode = rule.data.isShowQrcode;
|
|
|
|
- }
|
|
|
|
- // 限制购票回显
|
|
|
|
- if (shopData.saleRule === '1') {
|
|
|
|
- this.showoperat = true;
|
|
|
|
- } else {
|
|
|
|
- this.showoperat = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 图标回显
|
|
|
|
- if (shopData.icon) {
|
|
|
|
- this.iconurl = shopData.icon;
|
|
|
|
- } else {
|
|
|
|
- this.iconurl = '';
|
|
|
|
- }
|
|
|
|
- this.loading = false;
|
|
|
|
- }, 500);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
// 初始化编辑器
|
|
// 初始化编辑器
|
|
onEditorReady() {
|
|
onEditorReady() {
|
|
uni
|
|
uni
|
|
@@ -647,14 +715,12 @@ export default {
|
|
.context((res) => {
|
|
.context((res) => {
|
|
this.editorCtx = res.context;
|
|
this.editorCtx = res.context;
|
|
this.editorCtx.setContents({
|
|
this.editorCtx.setContents({
|
|
- html: shopData.describ, //this.EditGoodsDetail.content为赋值内容。
|
|
|
|
|
|
+ html: this.shopData.describ, //this.EditGoodsDetail.content为赋值内容。
|
|
});
|
|
});
|
|
})
|
|
})
|
|
.exec();
|
|
.exec();
|
|
},
|
|
},
|
|
-
|
|
|
|
// -----------------------------------------------------------------
|
|
// -----------------------------------------------------------------
|
|
-
|
|
|
|
// 跳转到管理分类页面
|
|
// 跳转到管理分类页面
|
|
toClassify() {
|
|
toClassify() {
|
|
if (this.storeId) {
|
|
if (this.storeId) {
|
|
@@ -689,69 +755,72 @@ export default {
|
|
async getShopList() {
|
|
async getShopList() {
|
|
this.storeList = [{ name: '所属店铺', id: '', type: '' }];
|
|
this.storeList = [{ name: '所属店铺', id: '', type: '' }];
|
|
await this.$http
|
|
await this.$http
|
|
- .get('/shop/getList', {
|
|
|
|
- mid: this.scenicId,
|
|
|
|
- })
|
|
|
|
- .then(async (res) => {
|
|
|
|
|
|
+ .get('/shop/getList', { mid: this.scenicId })
|
|
|
|
+ .then((res) => {
|
|
if (res.data) {
|
|
if (res.data) {
|
|
let arr = [];
|
|
let arr = [];
|
|
- res.data.forEach((element) => {
|
|
|
|
|
|
+ res.data.forEach((element) =>
|
|
arr.push({
|
|
arr.push({
|
|
name: element.name,
|
|
name: element.name,
|
|
id: element.id,
|
|
id: element.id,
|
|
- type: element.shopFrom // 是否是分销店铺
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ type: element.shopFrom,
|
|
|
|
+ })
|
|
|
|
+ );
|
|
this.storeList = this.storeList.concat(arr);
|
|
this.storeList = this.storeList.concat(arr);
|
|
this.storeDisable = false;
|
|
this.storeDisable = false;
|
|
-
|
|
|
|
// 所属店铺回显
|
|
// 所属店铺回显
|
|
- if (shopData.shopId) {
|
|
|
|
|
|
+ if (this.shopData.shopId) {
|
|
this.storeDisable = true;
|
|
this.storeDisable = true;
|
|
this.storeList.forEach((item, index) => {
|
|
this.storeList.forEach((item, index) => {
|
|
- if (shopData.shopId === item.id) {
|
|
|
|
|
|
+ if (this.shopData.shopId === item.id) {
|
|
this.storeIndex = index;
|
|
this.storeIndex = index;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.storeId = this.storeList[this.storeIndex].id;
|
|
this.storeId = this.storeList[this.storeIndex].id;
|
|
this.typeProperty = this.storeList[this.storeIndex].type;
|
|
this.typeProperty = this.storeList[this.storeIndex].type;
|
|
|
|
+
|
|
|
|
+ this.getType(this.storeId);
|
|
|
|
+ this.getLine(this.storeId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 商品类型
|
|
// 商品类型
|
|
- async getType() {
|
|
|
|
|
|
+ async getType(storeId) {
|
|
this.typeList = [{ name: '商品类型(请先选择所属店铺)', id: '' }];
|
|
this.typeList = [{ name: '商品类型(请先选择所属店铺)', id: '' }];
|
|
- 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.$http
|
|
|
|
+ .get('/type/getTypeListByShopId', {
|
|
|
|
+ id: storeId,
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ let arr = [];
|
|
|
|
+ res.data[0].children.forEach((element) => {
|
|
|
|
+ arr.push({ name: element.name, id: element.id });
|
|
});
|
|
});
|
|
- this.typeId = this.typeList[this.typeIndex].id;
|
|
|
|
- this.shopname = shopData.name;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 商品名称
|
|
// 商品名称
|
|
- async getShopName() {
|
|
|
|
|
|
+ async getShopName(typeId, storeId) {
|
|
|
|
+ this.loading = true
|
|
this.shopList = [{ name: '商品名称(请先选择商品类型)', id: '' }];
|
|
this.shopList = [{ name: '商品名称(请先选择商品类型)', id: '' }];
|
|
await this.$http
|
|
await this.$http
|
|
.get('/goods/getTicketGoods', {
|
|
.get('/goods/getTicketGoods', {
|
|
- typeId: this.typeId || shopData.typeId,
|
|
|
|
- shopId: this.storeId || shopData.shopId
|
|
|
|
|
|
+ typeId: typeId,
|
|
|
|
+ shopId: storeId,
|
|
})
|
|
})
|
|
.then(async (res) => {
|
|
.then(async (res) => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
@@ -760,29 +829,42 @@ export default {
|
|
arr.push({ name: element.ticket_name, id: element.ticket_no });
|
|
arr.push({ name: element.ticket_name, id: element.ticket_no });
|
|
});
|
|
});
|
|
this.shopList = this.shopList.concat(arr);
|
|
this.shopList = this.shopList.concat(arr);
|
|
|
|
+ this.loading = false
|
|
|
|
|
|
// 回显名称
|
|
// 回显名称
|
|
- if (shopData.name) {
|
|
|
|
- this.shopList[0] = {name: shopData.name,id: shopData.ticketNo}
|
|
|
|
|
|
+ if (this.shopData.name) {
|
|
|
|
+ this.loading = true
|
|
|
|
+ if (this.shopData.ticketNo) {
|
|
|
|
+ // 分销没有ticketNo
|
|
|
|
+ this.shopList[0] = {
|
|
|
|
+ name: this.shopData.name,
|
|
|
|
+ id: this.shopData.ticketNo,
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ // 自营商品直接赋值
|
|
|
|
+ this.shopname = this.shopname.name;
|
|
|
|
+ }
|
|
this.shopList.forEach((item, index) => {
|
|
this.shopList.forEach((item, index) => {
|
|
- if (shopData.name === item.name) {
|
|
|
|
|
|
+ if (this.shopData.name === item.name) {
|
|
// this.shopList[0] = { name: '商品名称(请先选择商品类型)', id: '' }
|
|
// this.shopList[0] = { name: '商品名称(请先选择商品类型)', id: '' }
|
|
this.shopIndex = index;
|
|
this.shopIndex = index;
|
|
} else {
|
|
} else {
|
|
- this.shopIndex = 0
|
|
|
|
|
|
+ this.shopIndex = 0;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.shopId = this.shopList[this.shopIndex].id;
|
|
this.shopId = this.shopList[this.shopIndex].id;
|
|
|
|
+ this.loading = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 线路分配
|
|
// 线路分配
|
|
- async getLine() {
|
|
|
|
|
|
+ async getLine(storeId) {
|
|
|
|
+ this.loading = true
|
|
this.lineList = [{ name: '分类(请先选择所属商品)', id: '' }];
|
|
this.lineList = [{ name: '分类(请先选择所属商品)', id: '' }];
|
|
await this.$http
|
|
await this.$http
|
|
.get('/goods/getCustomGroupList', {
|
|
.get('/goods/getCustomGroupList', {
|
|
- shopId: this.storeId || shopData.shopId,
|
|
|
|
|
|
+ shopId: storeId,
|
|
})
|
|
})
|
|
.then(async (res) => {
|
|
.then(async (res) => {
|
|
let arr = [];
|
|
let arr = [];
|
|
@@ -792,15 +874,18 @@ export default {
|
|
});
|
|
});
|
|
this.lineList = this.lineList.concat(arr);
|
|
this.lineList = this.lineList.concat(arr);
|
|
this.lineDidsable = false;
|
|
this.lineDidsable = false;
|
|
|
|
+ this.loading = false
|
|
|
|
|
|
// 分类回显
|
|
// 分类回显
|
|
- if (shopData.customGroupId) {
|
|
|
|
|
|
+ if (this.shopData.customGroupId) {
|
|
|
|
+ this.loading = true
|
|
this.lineList.forEach((item, index) => {
|
|
this.lineList.forEach((item, index) => {
|
|
- if (shopData.customGroupId === item.id) {
|
|
|
|
|
|
+ if (this.shopData.customGroupId === item.id) {
|
|
this.lineIndex = index;
|
|
this.lineIndex = index;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.lineId = this.lineList[this.lineIndex].id;
|
|
this.lineId = this.lineList[this.lineIndex].id;
|
|
|
|
+ this.loading = false
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -833,8 +918,8 @@ export default {
|
|
// 图标上传
|
|
// 图标上传
|
|
uploadImg() {
|
|
uploadImg() {
|
|
let _self = this;
|
|
let _self = this;
|
|
- _self.uploadtxt = '上传中...'
|
|
|
|
- _self.progress = 0
|
|
|
|
|
|
+ _self.uploadtxt = '上传中...';
|
|
|
|
+ _self.progress = 0;
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
count: 1,
|
|
count: 1,
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
@@ -852,19 +937,20 @@ export default {
|
|
_self.Icon = res.fileID;
|
|
_self.Icon = res.fileID;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- fail: function (msg) {
|
|
|
|
- },
|
|
|
|
|
|
+ fail: function (msg) {},
|
|
onUploadProgress: function (progressEvent) {
|
|
onUploadProgress: function (progressEvent) {
|
|
- _self.progress = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
|
|
|
- if ( _self.progress === 100) {
|
|
|
|
- _self.uploadtxt = '上传成功'
|
|
|
|
|
|
+ _self.progress = Math.round(
|
|
|
|
+ (progressEvent.loaded * 100) / progressEvent.total
|
|
|
|
+ );
|
|
|
|
+ if (_self.progress === 100) {
|
|
|
|
+ _self.uploadtxt = '上传成功';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
});
|
|
});
|
|
},
|
|
},
|
|
fail: function (error) {
|
|
fail: function (error) {
|
|
- _self.uploadtxt = '已取消上传'
|
|
|
|
- }
|
|
|
|
|
|
+ _self.uploadtxt = '已取消上传';
|
|
|
|
+ },
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 图册上传
|
|
// 图册上传
|
|
@@ -924,12 +1010,17 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
let name = '';
|
|
let name = '';
|
|
- if (this.typeProperty === '1' ) {
|
|
|
|
- name = this.shopList[this.shopIndex].id
|
|
|
|
- } else if (this.typeProperty === '0') {
|
|
|
|
|
|
+ console.log('是否自营');
|
|
|
|
+ console.log(this.typeProperty);
|
|
|
|
+ if (this.typeProperty === 1) {
|
|
|
|
+ name = this.shopList[this.shopIndex].id;
|
|
|
|
+ } else if (this.typeProperty === 0) {
|
|
name = this.shopname;
|
|
name = this.shopname;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ console.log(name);
|
|
|
|
+
|
|
|
|
+ return;
|
|
if (!this.storeId) {
|
|
if (!this.storeId) {
|
|
this.$mHelper.toast('请选择所属商铺!');
|
|
this.$mHelper.toast('请选择所属商铺!');
|
|
return;
|
|
return;
|
|
@@ -986,28 +1077,31 @@ export default {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.$http
|
|
this.$http
|
|
.post('/goods/add', {
|
|
.post('/goods/add', {
|
|
- id: shopData.id || '',
|
|
|
|
|
|
+ id: this.shopData.id || '',
|
|
mid: this.scenicId,
|
|
mid: this.scenicId,
|
|
shopId: this.storeId,
|
|
shopId: this.storeId,
|
|
typeId: this.typeId,
|
|
typeId: this.typeId,
|
|
customGroupId: this.lineId,
|
|
customGroupId: this.lineId,
|
|
describ: this.mastKnow,
|
|
describ: this.mastKnow,
|
|
icon: this.Icon || '',
|
|
icon: this.Icon || '',
|
|
- del: shopData.del || '',
|
|
|
|
- upDown: shopData.upDown || '',
|
|
|
|
|
|
+ del: this.shopData.del || '',
|
|
|
|
+ upDown: this.shopData.upDown || '',
|
|
saleRule: this.showoperat, // 限制购票
|
|
saleRule: this.showoperat, // 限制购票
|
|
saleRuleJson: JSON.stringify(this.astrictDate),
|
|
saleRuleJson: JSON.stringify(this.astrictDate),
|
|
// 自营
|
|
// 自营
|
|
name: name,
|
|
name: name,
|
|
salePrice: this.price * 100 || null,
|
|
salePrice: this.price * 100 || null,
|
|
price: this.rateprice * 100 || null,
|
|
price: this.rateprice * 100 || null,
|
|
- expiredTime: this.expirationDate === '请选择商品过期日期' ? '' : this.expirationDate,
|
|
|
|
|
|
+ expiredTime:
|
|
|
|
+ this.expirationDate === '请选择商品过期日期'
|
|
|
|
+ ? ''
|
|
|
|
+ : this.expirationDate,
|
|
inventory: this.inventory,
|
|
inventory: this.inventory,
|
|
})
|
|
})
|
|
.then((res) => {
|
|
.then((res) => {
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
if (res.code === 200 && res.msg === 'OK') {
|
|
this.loading = false;
|
|
this.loading = false;
|
|
- if (shopData.id) {
|
|
|
|
|
|
+ if (this.shopData.id) {
|
|
this.$mHelper.toast('保存成功,请联系管理员进行审核');
|
|
this.$mHelper.toast('保存成功,请联系管理员进行审核');
|
|
} else {
|
|
} else {
|
|
this.$mHelper.toast('添加成功');
|
|
this.$mHelper.toast('添加成功');
|