From 24f34e8f8cac8093ee3333b9ba9691eb3d9e196e Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Tue, 15 Oct 2024 15:21:50 +0800
Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=BB=84=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=EF=BC=9A=20=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=94=AE=E5=8D=96=E6=97=B6=E9=97=B4=20=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=88=86=E7=BB=84=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../edit-group-goods/components/goods.vue | 2 +-
.../edit-group-goods/edit-group-goods.vue | 133 +++++++------
pageGoodsGroup/edit-group/edit-group.vue | 73 ++++++-
pageGoodsGroup/index/components/category.vue | 4 +-
pageGoodsGroup/index/components/edit-time.vue | 183 ++++++++++++++++++
pageGoodsGroup/index/index.vue | 17 +-
6 files changed, 349 insertions(+), 63 deletions(-)
create mode 100644 pageGoodsGroup/index/components/edit-time.vue
diff --git a/pageGoodsGroup/edit-group-goods/components/goods.vue b/pageGoodsGroup/edit-group-goods/components/goods.vue
index 8ac1b90..ffaaf1c 100644
--- a/pageGoodsGroup/edit-group-goods/components/goods.vue
+++ b/pageGoodsGroup/edit-group-goods/components/goods.vue
@@ -32,7 +32,7 @@
{{data.name}}
- ¥
+ ¥
{{data.lowPrice}}
diff --git a/pageGoodsGroup/edit-group-goods/edit-group-goods.vue b/pageGoodsGroup/edit-group-goods/edit-group-goods.vue
index 277ac19..e3eefd8 100644
--- a/pageGoodsGroup/edit-group-goods/edit-group-goods.vue
+++ b/pageGoodsGroup/edit-group-goods/edit-group-goods.vue
@@ -14,12 +14,13 @@
-
+
@@ -36,13 +37,12 @@
-
+
-
+
@@ -52,9 +52,9 @@
-
+
@@ -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()
+ }
+ })
\ No newline at end of file
diff --git a/pageGoodsGroup/index/index.vue b/pageGoodsGroup/index/index.vue
index 80ff21e..9761a09 100644
--- a/pageGoodsGroup/index/index.vue
+++ b/pageGoodsGroup/index/index.vue
@@ -25,6 +25,7 @@
+
@@ -44,6 +45,7 @@
import infoBox from "@/commons/utils/infoBox.js"
import editSort from './components/edit-sort.vue';
import editName from './components/edit-name.vue';
+ import editTime from './components/edit-time.vue';
import {
tbProductGroupGet,
tbProductGroupDelete,
@@ -66,7 +68,13 @@
name: '管理商品',
color: '#333',
fontSize: '16'
- }],
+ },
+ {
+ name: '售卖时间',
+ color: '#333',
+ fontSize: '16'
+ }
+ ],
show: false,
})
@@ -82,6 +90,9 @@
})
}
+ if (e.name == '售卖时间') {
+ return popupShow(actions.selIndex, 'time', true)
+ }
}
function actionsHide() {
@@ -106,6 +117,9 @@
},
name:{
show: false
+ },
+ time:{
+ show: false
}
})
@@ -119,6 +133,7 @@
const res = await $productCategory.update(e)
popup.sort.show = false;
popup.name.show = false;
+ popup.time.show = false;
pageData.list[popup.selIndex] = e
infoBox.showToast('更新成功')
}