fixed bug adout shop
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
<view>
|
||||
<view class="titles">标签</view>
|
||||
<view class="form-view active" @click="show_add()">+ 新建标签</view>
|
||||
<view :class="['form-view',item.state == true ? 'active' : '']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||
<view :class="['form-view', item.state == true ? 'active' : '']" v-for="(item, index) in fileListes" :key="index" @click="changeselect(index)">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -46,10 +46,17 @@
|
||||
<view class="title"><text>选择商品</text></view>
|
||||
<!-- 商品列表 -->
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index" @click="checkboxChange(item.goods_id)">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<u-checkbox-group>
|
||||
<u-checkbox shape="circle" active-color="#FF780F" v-model="item.checked" :disabled="true"></u-checkbox>
|
||||
<u-checkbox
|
||||
shape="circle"
|
||||
size="40"
|
||||
active-color="#FF780F"
|
||||
v-model="item.checked"
|
||||
:name="index"
|
||||
@change="checkboxChange"
|
||||
></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
<view><image :src="item.goods_image" mode="widthFix"></image></view>
|
||||
@@ -118,6 +125,8 @@ export default {
|
||||
checked: false,
|
||||
list: [],
|
||||
List_tosign: [],
|
||||
flagA: true,
|
||||
flagB: false,
|
||||
scrollTop: 0,
|
||||
imgarr: [], //上传图片数组
|
||||
cover: '', //图文封面
|
||||
@@ -137,31 +146,34 @@ export default {
|
||||
for (let index in arr) {
|
||||
newarr.push(arr[index].file_id);
|
||||
}
|
||||
this.$u.api.publishphoto({
|
||||
article_title: this.form.name,
|
||||
article_content: this.form.intro,
|
||||
article_pic: this.imgarrA[0].file_name,
|
||||
file_id: newarr,
|
||||
goods_id_arr: this.arres_list,
|
||||
label_arr: this.selectarr
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
setTimeout(function(){
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
console.log(this.imgarrA);
|
||||
this.$u.api
|
||||
.publishphoto({
|
||||
article_title: this.form.name,
|
||||
article_content: this.form.intro,
|
||||
article_pic: this.imgarrA[0].file_name,
|
||||
file_id: newarr,
|
||||
goods_id_arr: this.arres_list,
|
||||
label_arr: this.selectarr
|
||||
})
|
||||
.then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取商品数组变化
|
||||
getshoplist(id) {
|
||||
@@ -207,35 +219,52 @@ export default {
|
||||
},
|
||||
// 创建标签
|
||||
addLiveSpec() {
|
||||
this.$u.api.createLivesp({
|
||||
spec_name: this.tagcontent
|
||||
}).then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.tagcontent = '';
|
||||
this.show = false;
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
this.$u.api
|
||||
.createLivesp({
|
||||
spec_name: this.tagcontent
|
||||
})
|
||||
.then(res => {
|
||||
if (res.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
this.tagcontent = '';
|
||||
this.show = false;
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 上传封面
|
||||
uploadcover(data) {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrA.push(obj);
|
||||
console.log(data);
|
||||
if (data.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: '上传失败',
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrA.push(obj);
|
||||
}
|
||||
},
|
||||
// 上传图片
|
||||
uploadphoto(data) {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrB.push(obj);
|
||||
if (data.errCode != 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: '上传失败',
|
||||
type: 'error'
|
||||
});
|
||||
} else {
|
||||
let obj = data.data;
|
||||
obj.url = obj.file_path;
|
||||
this.imgarrB.push(obj);
|
||||
}
|
||||
},
|
||||
changes() {
|
||||
let that = this;
|
||||
@@ -246,16 +275,14 @@ export default {
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
let id = e;
|
||||
for(let num in this.list){
|
||||
if(id==this.list[num].goods_id){
|
||||
if(this.list[num].checked==true){
|
||||
this.delarr(id);
|
||||
}else{
|
||||
this.pushes(id);
|
||||
}
|
||||
this.list[num].checked = !this.list[num].checked
|
||||
}
|
||||
let that = this;
|
||||
let num =Number(e.name)
|
||||
if (e.value == true) {
|
||||
that.delarr(that.list[num].goods_id);
|
||||
that.list[num].checked=true
|
||||
} else {
|
||||
that.pushes(that.list[num].goods_id);
|
||||
that.list[num].checked=false
|
||||
}
|
||||
},
|
||||
// 删除直播商品
|
||||
@@ -288,7 +315,7 @@ export default {
|
||||
} else {
|
||||
let arr = res.data.list;
|
||||
for (let index in arr) {
|
||||
arr[index].checked = false;
|
||||
arr[index].checked = true;
|
||||
}
|
||||
this.list = arr;
|
||||
}
|
||||
@@ -312,7 +339,7 @@ export default {
|
||||
margin: 0 auto;
|
||||
|
||||
.form-view {
|
||||
background: #CDC7C8;
|
||||
background: #cdc7c8;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
@@ -322,7 +349,7 @@ export default {
|
||||
color: #fff;
|
||||
}
|
||||
.active {
|
||||
background: #FF780F;
|
||||
background: #ff780f;
|
||||
}
|
||||
.scroll {
|
||||
width: 100%;
|
||||
|
||||
@@ -37,10 +37,17 @@
|
||||
<view class="title"><text>选择商品</text></view>
|
||||
<!-- 商品列表 -->
|
||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index" @click="checkboxChange(item.goods_id)">
|
||||
<view class="listes_shoping" v-for="(item, index) in list" :key="index">
|
||||
<view>
|
||||
<u-checkbox-group>
|
||||
<u-checkbox shape="circle" active-color="#FF780F" v-model="item.checked" :disabled="true" ></u-checkbox>
|
||||
<u-checkbox
|
||||
shape="circle"
|
||||
size="40"
|
||||
active-color="#FF780F"
|
||||
v-model="item.checked"
|
||||
:name="index"
|
||||
@change="checkboxChange"
|
||||
></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
<view><image :src="item.goods_image" mode="widthFix"></image></view>
|
||||
@@ -275,15 +282,14 @@ export default {
|
||||
},
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
checkboxChange(e) {
|
||||
for(let num in this.list){
|
||||
if(id==this.list[num].goods_id){
|
||||
if(this.list[num].checked==true){
|
||||
this.delarr(id);
|
||||
}else{
|
||||
this.pushes(id);
|
||||
}
|
||||
this.list[num].checked = !this.list[num].checked
|
||||
}
|
||||
let that = this;
|
||||
let num =Number(e.name)
|
||||
if (e.value == true) {
|
||||
that.delarr(that.list[num].goods_id);
|
||||
that.list[num].checked=true
|
||||
} else {
|
||||
that.pushes(that.list[num].goods_id);
|
||||
that.list[num].checked=false
|
||||
}
|
||||
},
|
||||
// 删除直播商品
|
||||
|
||||
Reference in New Issue
Block a user