tianyi 1 month ago
parent
commit
48171fb19a
  1. 43
      pages/shop/addGoods.vue
  2. 60
      pages/shop/goodsList.vue

43
pages/shop/addGoods.vue

@ -23,7 +23,7 @@
</view> </view>
<view style="overflow-x: scroll;display: flex;width: 350rpx;"> <view style="overflow-x: scroll;display: flex;width: 350rpx;">
<view v-if="formData.productPicture !=''" style="width: 160rpx;height: 160rpx;margin-left: 20rpx;"> <view v-if="formData.productPicture !=''" style="width: 160rpx;height: 160rpx;margin-left: 20rpx;">
<image :src="formData.productPicture" alt="" class="upload-img"> <img :src="formData.productPicture" alt="" class="upload-img">
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
@ -31,8 +31,9 @@
<input type="digit" class="content-input" v-model="formData.orderFiled" placeholder="请输入排名"> <input type="digit" class="content-input" v-model="formData.orderFiled" placeholder="请输入排名">
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="商品分类" name="editTitle"> <uni-forms-item label="商品分类" name="editTitle">
<view @click="goGategoryLow" style="height:70rpx;border: 4rpx solid #eee;display: flex;flex: 1;border-radius: 10rpx;"> <view style="border: 4rpx solid #eee;display: flex;flex: 1;border-radius: 10rpx;">
<text class="content-input" style="height:70rpx;border: 0;">{{typeItem.categoryName}}</text> <input type="text" placeholder="请选择商品分类" disabled v-model="typeItem.categoryName"
class="content-input" @tap="goGategoryLow" style="border: 0;">
<uni-icons type="right" size="16" <uni-icons type="right" size="16"
style="margin-left: 40rpx;line-height: 70rpx;"></uni-icons> style="margin-left: 40rpx;line-height: 70rpx;"></uni-icons>
</view> </view>
@ -55,7 +56,9 @@
<view v-for="(item,index) in formData.productGroupBuyPrices" :key="index" style="display: flex;margin-top:10rpx;"> <view v-for="(item,index) in formData.productGroupBuyPrices" :key="index" style="display: flex;margin-top:10rpx;">
<input type="number" min="2" class="content-input" v-model="item.groupCount" style="padding-right: 20rpx;margin-right: 20rpx;width: 100px;" placeholder="成团人数" /> <input type="number" min="2" class="content-input" v-model="item.groupCount" style="padding-right: 20rpx;margin-right: 20rpx;width: 100px;" placeholder="成团人数" />
<input type="digit" class="content-input" v-model="item.groupPrice" style="padding-right: 20rpx;width: 100px;" placeholder="拼团价格"/> <input type="digit" class="content-input" v-model="item.groupPrice" style="padding-right: 20rpx;width: 100px;" placeholder="拼团价格"/>
<view @click="delGroup(index)" v-if="formData.productGroupBuyPrices.length>1" style="width: 240rpx;height: 60rpx;line-height: 60rpx;color: red;border:none;background: #fff;">删除</view> <view class="group-delete-btn" @tap.stop="delGroup(index)">
<uni-icons type="trash" size="20" color="#ff4d4f"></uni-icons>
</view>
</view> </view>
<view @click="addGroup()" style="margin-top: 10rpx;width: 160rpx;height: 60rpx;text-align: center;line-height: 60rpx;background: rgba(0, 35, 28, 1);border-radius: 60rpx;color: rgba(166, 255, 234, 1);"> <view @click="addGroup()" style="margin-top: 10rpx;width: 160rpx;height: 60rpx;text-align: center;line-height: 60rpx;background: rgba(0, 35, 28, 1);border-radius: 60rpx;color: rgba(166, 255, 234, 1);">
新增拼团 新增拼团
@ -116,6 +119,7 @@
<uni-forms-item label="详细图文" name="startPayNum"> <uni-forms-item label="详细图文" name="startPayNum">
<view class="xiangxi-box"> <view class="xiangxi-box">
<sp-editor <sp-editor
:keys="keys"
@init="initEditor" @init="initEditor"
@input="inputOver" @input="inputOver"
@upinImage="upinImage" @upinImage="upinImage"
@ -237,7 +241,6 @@
onShow() { onShow() {
this.attrId = uni.getStorageSync('attrId'); this.attrId = uni.getStorageSync('attrId');
this.shopMerchantType = uni.getStorageSync('shopMerchantType'); this.shopMerchantType = uni.getStorageSync('shopMerchantType');
if (this.hasSelectedTypeItem(this.typeItem)) { if (this.hasSelectedTypeItem(this.typeItem)) {
this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) this.typeItem = JSON.parse(JSON.stringify(this.typeItem))
this.formData.categoryId = this.typeItem.id this.formData.categoryId = this.typeItem.id
@ -385,7 +388,10 @@
this.productCategoryList = Array.isArray(res.result) ? res.result : [] this.productCategoryList = Array.isArray(res.result) ? res.result : []
this.syncSelectedCategory() this.syncSelectedCategory()
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -427,7 +433,6 @@
submit() { submit() {
let that = this; let that = this;
this.syncLunchBoxByMoreBuy() this.syncLunchBoxByMoreBuy()
this.normalizeGroupBuyPrices()
if (!this.validateProductSpecs()) { if (!this.validateProductSpecs()) {
return return
} }
@ -549,17 +554,6 @@
} }
return true return true
}, },
normalizeGroupBuyPrices() {
if (!Array.isArray(this.formData.productGroupBuyPrices)) {
this.formData.productGroupBuyPrices = []
return
}
this.formData.productGroupBuyPrices = this.formData.productGroupBuyPrices.filter((item) => {
const groupCount = item && item.groupCount !== undefined && item.groupCount !== null ? String(item.groupCount).trim() : ''
const groupPrice = item && item.groupPrice !== undefined && item.groupPrice !== null ? String(item.groupPrice).trim() : ''
return groupCount !== '' || groupPrice !== ''
})
},
isValidPrice(value) { isValidPrice(value) {
return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0 return /^\d+(\.\d{1,2})?$/.test(value) && Number(value) > 0
}, },
@ -852,7 +846,7 @@
let that = this let that = this
this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId", { this.NB.sendRequest("/app/productAttributeValue/selectByAttributeId", {
id: id, id: id,
}, false, 'get', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
that.categorySonData = res.result that.categorySonData = res.result
for (var i = 0; i < that.categorySonData.length; i++) { for (var i = 0; i < that.categorySonData.length; i++) {
@ -1050,6 +1044,17 @@
box-sizing: border-box; box-sizing: border-box;
min-width: 0; min-width: 0;
} }
.group-delete-btn {
flex: 0 0 70rpx;
width: 70rpx;
height: 70rpx;
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 10rpx;
}
.keyboard-safe-bottom { .keyboard-safe-bottom {
height: 260rpx; height: 260rpx;
} }

60
pages/shop/goodsList.vue

@ -262,9 +262,15 @@
}else{ }else{
this.shopList1[index].isPush = value this.shopList1[index].isPush = value
} }
this.tui.toast('设置成功') uni.showToast({
title: '设置成功',
icon: 'none'
})
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -280,9 +286,15 @@
}, false, 'post', 'application/x-www-form-urlencoded').then((res) => { }, false, 'post', 'application/x-www-form-urlencoded').then((res) => {
if (res.code == 200) { if (res.code == 200) {
that.getShareList() that.getShareList()
that.tui.toast('删除成功') uni.showToast({
title: '删除成功',
icon: 'none'
})
} else { } else {
that.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
} }
@ -300,9 +312,15 @@
}else{ }else{
this.shopList1[index].isMust = value this.shopList1[index].isMust = value
} }
this.tui.toast('设置成功') uni.showToast({
title: '设置成功',
icon: 'none'
})
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -317,9 +335,15 @@
}else{ }else{
this.shopList1[index].delFlag = value this.shopList1[index].delFlag = value
} }
this.tui.toast('设置成功') uni.showToast({
title: '设置成功',
icon: 'none'
})
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}else{ }else{
@ -332,9 +356,15 @@
}else{ }else{
this.shopList1[index].delFlag = value this.shopList1[index].delFlag = value
} }
this.tui.toast('设置成功') uni.showToast({
title: '设置成功',
icon: 'none'
})
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
} }
@ -406,7 +436,10 @@
} }
this.status = this.pageNum >= this.pages ? 'nomore' : 'loadmore' this.status = this.pageNum >= this.pages ? 'nomore' : 'loadmore'
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}, },
@ -460,7 +493,10 @@
this.categoryId = this.indexList[0].id this.categoryId = this.indexList[0].id
this.getShareList(); this.getShareList();
} else { } else {
this.tui.toast(res.message) uni.showToast({
title: res.message,
icon: 'none'
})
} }
}) })
}, },

Loading…
Cancel
Save