商品分组更新:
增加编辑售卖时间 编辑分组名称
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<text class="u-m-r-24">{{data.name}}</text>
|
||||
</view>
|
||||
<view class="u-font-32">
|
||||
<text v-if="data.typeEnum=='单规格'">¥</text>
|
||||
<text v-if="data.typeEnum=='单规格'||data.typeEnum=='normal'">¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
</view>
|
||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
|
||||
@clear="searchFunc"
|
||||
@confirm="searchFunc">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
<button type="text" @click="searchFunc()">搜索</button>
|
||||
<button type="text" @click="searchFunc">搜索</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex states1 u-row-between u-font-28">
|
||||
@@ -36,13 +37,12 @@
|
||||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.bindGoodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
|
||||
<my-goods isBind @radioClick="goodsRadioClick" :index="index"
|
||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<my-goods isBind @radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
|
||||
<my-img-empty tips="暂无绑定商品"></my-img-empty>
|
||||
<my-img-empty :tips="isSearch?'未搜索到相关绑定商品':'暂无绑定商品' "></my-img-empty>
|
||||
</template>
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
@@ -52,9 +52,9 @@
|
||||
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods @goodsClick="goodsClick"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<my-goods @goodsClick="goodsClick" @radioClick="goodsRadioClick" :index="index" :data="item"
|
||||
@del="goodsDel" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
||||
@@ -117,9 +117,11 @@
|
||||
upGroupSort,
|
||||
tbProductGroupPost
|
||||
} from "@/http/yskApi/shop.js"
|
||||
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
|
||||
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
@@ -154,17 +156,7 @@
|
||||
categoryName: '',
|
||||
hasAjax: false
|
||||
})
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
|
||||
watch(()=>pageData.stateCurrent,(newval)=>{
|
||||
if(newval){
|
||||
setGoodsList()
|
||||
}else{
|
||||
init()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function isGroundingChange(e) {
|
||||
const {
|
||||
@@ -191,27 +183,33 @@
|
||||
console.log(e);
|
||||
pageData.goodsList[e].checked = !pageData.goodsList[e].checked
|
||||
}
|
||||
|
||||
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
console.log(pageData.query.categoryId );
|
||||
pageData.categoryName = category.name
|
||||
}
|
||||
|
||||
let $goodsList=[]
|
||||
function setGoodsList(){
|
||||
pageData.goodsList = $goodsList.filter(v=>!pageData.bindGoodsList.find(bindGoods=>bindGoods.id==v.id))
|
||||
|
||||
let $goodsList = []
|
||||
|
||||
function setGoodsList() {
|
||||
pageData.goodsList = $goodsList.filter(v => {
|
||||
return !pageData.bindGoodsList.find(bindGoods => bindGoods.id == v.id)
|
||||
})
|
||||
}
|
||||
|
||||
function getGoodsList() {
|
||||
$tbProductV2(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
pageData.totalElements = res.totalElements
|
||||
$goodsList=res.content.map(v=>{
|
||||
$goodsList = res.content.map(v => {
|
||||
return {
|
||||
...v,checked:false
|
||||
...v,
|
||||
checked: false
|
||||
}
|
||||
})
|
||||
setGoodsList()
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
@@ -219,21 +217,16 @@
|
||||
})
|
||||
async function getGroupBindGoods() {
|
||||
const res = await productListGet(option.id)
|
||||
pageData.bindGoodsList = res
|
||||
pageData.bindGoodsList = res.filter(v=>{
|
||||
return pageData.query.categoryId===''?true:(v.categoryId==pageData.query.categoryId)&&(v.name.includes(pageData.query.name))
|
||||
})
|
||||
}
|
||||
const option = reactive({})
|
||||
async function init() {
|
||||
const res = await productListGet(option.id)
|
||||
pageData.bindGoodsList = res
|
||||
await getGroupBindGoods()
|
||||
getGoodsList()
|
||||
}
|
||||
onLoad((opt) => {
|
||||
tbProductGroupGet({
|
||||
page: 0,
|
||||
size: 999,
|
||||
sort: 'id',
|
||||
shopId: uni.getStorageSync('shopId')
|
||||
})
|
||||
Object.assign(option, opt)
|
||||
init()
|
||||
// $tbShopCategory({
|
||||
@@ -263,28 +256,30 @@
|
||||
}
|
||||
|
||||
async function save() {
|
||||
const res=await hasPermission('允许修改分组')
|
||||
if(!res){
|
||||
const res = await hasPermission('允许修改分组')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
console.log(pageData.goodsList);
|
||||
await tbProductGroupPut({
|
||||
...option,
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
productIds:[...pageData.bindGoodsList.map(v=>v.id),...pageData.goodsList.filter(v=>v.checked).map(v=>v.id)]
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productIds: [...pageData.bindGoodsList.map(v => v.id), ...pageData.goodsList.filter(v => v.checked)
|
||||
.map(v => v.id)
|
||||
]
|
||||
})
|
||||
pageData.stateCurrent=0
|
||||
pageData.stateCurrent = 0
|
||||
}
|
||||
|
||||
|
||||
function updateGroup(){
|
||||
|
||||
|
||||
|
||||
function updateGroup() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//删除商品
|
||||
async function goodsDel(index) {
|
||||
const res=await hasPermission('允许修改分组')
|
||||
if(!res){
|
||||
const res = await hasPermission('允许修改分组')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
const goods = pageData.bindGoodsList[index]
|
||||
@@ -296,8 +291,8 @@
|
||||
pageData.bindGoodsList.splice(index, 1)
|
||||
tbProductGroupPut({
|
||||
...option,
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
productIds:pageData.bindGoodsList.map(v=>v.id)
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productIds: pageData.bindGoodsList.map(v => v.id)
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
@@ -307,6 +302,7 @@
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index
|
||||
console.log(pageData.stateCurrent);
|
||||
}
|
||||
|
||||
|
||||
@@ -341,10 +337,20 @@
|
||||
function isHasChekdGoods() {
|
||||
return getChechkedGoodsList().length ? true : false
|
||||
}
|
||||
|
||||
function searchFunc() {
|
||||
|
||||
|
||||
let isSearch=ref(false)
|
||||
async function searchFunc() {
|
||||
isSearch.value=true
|
||||
console.log('searchFunc');
|
||||
getGoodsList()
|
||||
if (pageData.stateCurrent) {
|
||||
getGoodsList()
|
||||
} else {
|
||||
const res = await productListGet(option.id)
|
||||
pageData.bindGoodsList = res.filter(v=>{
|
||||
return v.name.includes(pageData.query.name)&&(pageData.query.categoryId===''?true:v.categoryId==pageData.query.categoryId)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let showChecked = ref(false)
|
||||
@@ -407,6 +413,21 @@
|
||||
pageData.category = cate
|
||||
getGoodsList()
|
||||
}
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
if(pageData.stateCurrent==1){
|
||||
getGoodsList()
|
||||
}else{
|
||||
getGroupBindGoods()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => pageData.stateCurrent, (newval) => {
|
||||
if (newval==1) {
|
||||
getGoodsList()
|
||||
} else {
|
||||
getGroupBindGoods()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
|
||||
Reference in New Issue
Block a user