代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -2,9 +2,6 @@
<view class="safe-page min-page">
<up-sticky>
<view class="bg-fff u-p-l-30 u-p-b-30">
<!-- <view class="myTabs ">
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
</view> -->
<view class="input-wrapper">
<view class="input-main">
<view class="u-flex u-p-r-30 u-font-28" @click="onCategoryShowChange(true)">
@@ -36,7 +33,7 @@
</view>
<view class="u-flex u-col-center" @click="go.to('PAGES_PRODUCT_SPECIF_TEMPLATE')">
<image src="/pageProduct/static/images/icon-guige.svg" class="icon-guige" />
<text class="color-666 u-m-l-12 u-font-24">规格模版</text>
<text class="color-666 u-m-l-12 u-font-24">规格</text>
</view>
</view>
@@ -56,7 +53,7 @@
<my-img-empty tips="未找到相关商品"></my-img-empty>
</template>
<template v-if="pageData.goodsList.length">
<my-pagination :page="pageData.query.page+1" :totalElements="pageData.totalElements" :size="pageData.query.size"
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination>
</template>
@@ -77,7 +74,7 @@
<view>
<view class="">排序:</view>
<view class="u-m-t-24">
<uni-easyinput v-model="goodsStockData.sort" placeholder="请输入排序"></uni-easyinput>
<uni-easyinput v-model="goodsStockData.orderBy" placeholder="请输入排序"></uni-easyinput>
</view>
</view>
<view class="u-flex u-m-t-32">
@@ -95,13 +92,13 @@
<view class="u-flex u-m-t-32">
<view class="">售罄:</view>
<view class="u-m-l-46 ">
<my-switch v-model="goodsStockData.isPauseSale"></my-switch>
<my-switch v-model="goodsStockData.isSoldStock"></my-switch>
</view>
</view>
<view class="u-flex u-m-t-32">
<view class="">上架:</view>
<view class="u-m-l-46 ">
<my-switch v-model="goodsStockData.isGrounding"></my-switch>
<my-switch v-model="goodsStockData.isSale"></my-switch>
</view>
</view> -->
@@ -176,6 +173,11 @@
$tbProductV2,
$updateProductData
} from "@/http/yskApi/goods.js"
import {
getProductList,
getCategoryList
} from '@/api/product.js'
import {
returnAllCategory
} from '@/pageProduct/util.js'
@@ -195,15 +197,13 @@
totalPage: 0,
goodsList: [],
query: {
page: 0,
page: 1,
size: 10,
createdAt: [],
id: "",
categoryId: '',
name: '',
isPauseSale: '',
sort: "createdAt,desc",
isGrounding: ''
orderBy: "create_time desc",
isSoldStock: '',
isSale: ''
},
category: '',
categoryList: [], //分类列表
@@ -214,10 +214,10 @@
watch(() => pageData.query.categoryId, (newval) => {
getGoodsList()
})
watch(() => pageData.query.isPauseSale, (newval) => {
watch(() => pageData.query.isSoldStock, (newval) => {
getGoodsList()
})
watch(() => pageData.query.isGrounding, (newval) => {
watch(() => pageData.query.isSale, (newval) => {
getGoodsList()
})
const popup = reactive({
@@ -237,7 +237,47 @@
show: false
}
})
onShow(() => {
// getGoodsList()
watchEmitInit()
})
onLoad(() => {
getGoodsList()
getCategory()
})
/**
* 获取商品列表
*/
function getGoodsList() {
pageData.hasAjax = false
getProductList(pageData.query).then(res => {
pageData.hasAjax = true
pageData.goodsList = res.records.map(v => {
return {
...v,
isSellNone: false,
checked: false,
showDetail: false
}
})
pageData.totalElements = res.totalRow
})
}
/**
* 获取商品分类列表
*/
function getCategory () {
getCategoryList({
page: 1,
size: 200
}).then(res => {
pageData.categoryList = returnAllCategory(res)
console.log(pageData.categoryList);
})
}
//报损弹窗展示
function baosunShow(index) {
pageData.selGoodsIndex = index
@@ -246,17 +286,22 @@
popup.baosun.show = true
}
// 修改价格弹窗展示
/**
* 修改价格弹窗展示
* @param {Object} index
*/
function changePriceShow(index) {
pageData.selGoodsIndex = index
const goods = pageData.goodsList[index]
console.log(goods)
goods.skuList = goods.skuList.map(v => {
return {
...v,
_lowPrice: v.lowPrice
}
})
const lowPrice = goods.lowPrice.replace('¥', '') * 1
console.log(goods)
const lowPrice = goods.lowPrice.toString().replace('¥', '') * 1
pageData.selGoods = {
...goods,
lowPrice,
@@ -354,27 +399,31 @@
//修改规格上下架,售罄
function editGuigeShow(goodsIndex, guigeIndex) {
console.log(goodsIndex, guigeIndex);
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
console.log(goodsIndex, guigeIndex);
popup.guige.data = goodsGuige
popup.guige.goodsIndex = goodsIndex
popup.guige.guigeIndex = guigeIndex
popup.guige.show = true
}
/**
* 规格上下架
* @param {Object} e
*/
function isGroundingChange(e) {
const {
goodsIndex,
guigeIndex
} = popup.guige
const { goodsIndex, guigeIndex } = popup.guige
console.log(goodsIndex,guigeIndex)
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
}
/**
* 规格已售罄
* @param {Object} e
*/
function isPauseSaleChange(e) {
const {
goodsIndex,
guigeIndex
} = popup.guige
const { goodsIndex, guigeIndex } = popup.guige
console.log(goodsIndex,guigeIndex)
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
}
@@ -388,22 +437,6 @@
pageData.categoryName = category.name
}
function getGoodsList() {
pageData.hasAjax = false
$tbProductV2(pageData.query).then(res => {
pageData.hasAjax = true
console.log(res);
pageData.goodsList = res.content.map(v => {
return {
...v,
isSellNone: false,
checked: false,
showDetail: false
}
})
pageData.totalElements = res.totalElements
})
}
function watchEmitInit() {
uni.$off('update:productIndex')
@@ -419,20 +452,7 @@
})
}
onShow(() => {
// getGoodsList()
watchEmitInit()
})
onLoad(() => {
getGoodsList()
$tbShopCategory({
page: 0,
size: 200
}).then(res => {
pageData.categoryList = returnAllCategory(res.content)
console.log(pageData.categoryList);
})
})
const tabsList = ['简洁', '详情']
const statesTabsList = ['全部', '已售罄', '在售中', '已下架']
@@ -451,7 +471,7 @@
sort: 0,
isStock: false,
isDistribute: false,
isPauseSale: false,
isSoldStock: false,
isGrounding: false,
stockNumber: 0,
})
@@ -516,7 +536,7 @@
function resetQuery() {
pageData.totalElements = 0;
pageData.query.page = 0;
pageData.query.page = 1;
}
async function toGoodsDetail(id) {
@@ -535,23 +555,23 @@
resetQuery()
console.log(index);
if (index == 0) {
pageData.query.isPauseSale = ''
pageData.query.isGrounding = ''
pageData.query.isSoldStock = ''
pageData.query.isSale = ''
return
}
if (index == 1) {
pageData.query.isPauseSale = 1
pageData.query.isGrounding = ''
pageData.query.isSoldStock = 1
pageData.query.isSale = ''
return
}
if (index == 2) {
pageData.query.isPauseSale = ''
pageData.query.isGrounding = 1
pageData.query.isSoldStock = ''
pageData.query.isSale = 1
return
}
if (index == 3) {
pageData.query.isPauseSale = ''
pageData.query.isGrounding = 0
pageData.query.isSoldStock = ''
pageData.query.isSale = 0
return
}
}
@@ -638,7 +658,7 @@
// 页数改变事件
function pageChange(page) {
console.log(page);
pageData.query.page = page - 1
pageData.query.page = page
getGoodsList()
}