代码更新

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

@@ -12,7 +12,6 @@
</view>
</view>
<view>
<!-- <text class="u-font-28 color-666" @click="changeClick">修改</text> -->
<text class="u-font-28 color-666" @click="changePrice">改价</text>
<text class="u-font-28 color-red u-m-l-24" @click="baosun">报损</text>
</view>
@@ -37,7 +36,7 @@
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
</view>
<view class="u-font-32">
<text v-if="data.typeEnum=='单规格'">¥</text>
<text v-if="data.type=='single'">¥</text>
<text>{{data.lowPrice}}</text>
<!-- <text>¥</text>
<text>{{data.lowPrice}}</text>
@@ -50,18 +49,11 @@
<view class="u-font-24 info-p-l u-m-t-6">规格</view>
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
@click="guigeClick(index)">
<text>{{item.specSnap||item.name}}</text>
<text>{{item.specInfo}}</text>
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
<view class="tag-gray tag" v-if="item.isPauseSale">已售罄</view>
<view class="tag-gray tag" v-if="!item.isGrounding">已下架</view>
<!-- <template v-if="item.isPauseSale">
<view class="tag-gray tag" >已售罄</view>
</template>
<template v-else>
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
<view class="tag-gray tag" v-else>已下架</view>
</template> -->
</view>
</view>
@@ -89,23 +81,15 @@
</view>
</view>
<!-- <view class="u-m-t-16 skus u-text-center" v-if="data.skuList.length>=2">
<view class="u-flex u-flex-wrap skds">
<view class="skd" v-for="(item,index) in data.skuList" :key="index"><text>{{item.specSnap}}</text>
<view class="tag-primary tag">上架中</view>
</view>
</view>
</view> -->
<view class="u-m-t-24 u-flex u-row-between">
<view class="u-flex">
<view class="u-flex">
<view class="u-m-r-18 color-999">售罄</view>
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
<my-switch disabled v-model="isSoldStock" :openDisabledClass="false" @click="isSoldStockChange"></my-switch>
</view>
<view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">上架产品</view>
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
<my-switch disabled v-model="isSale" :openDisabledClass="false" @click="isSaleChange"></my-switch>
</view>
</view>
<view class="u-flex">
@@ -119,21 +103,11 @@
</template>
<script setup>
import {
computed,
ref,
watch,
watchEffect
} from 'vue';
import {
$goodsIsHot,
$tbProskuConV2,$updateProductData
} from '@/http/yskApi/goods.js'
import { computed, ref, watch } from 'vue';
import { updateProduct,productOnOff,productMarkIsSoldOut } from '@/api/product.js'
import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js';
import {
ColorMain
} from '@/commons/color.js'
import { ColorMain } from '@/commons/color.js'
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
'editStock'
])
@@ -175,7 +149,8 @@
const max=247;
for(let i in props.data.skuList){
const sku=props.data.skuList[i]
width+=(fontSize*sku.name.length+boxWith+gap)
console.log(sku)
width+=(fontSize*sku.specInfo.length+boxWith+gap)
if(width>max){
isOne=false
break;
@@ -189,10 +164,8 @@
}
async function upDateGoods(par) {
const res = await $updateProductData([{
const res = await updateProduct([{
id: props.data.id,
isSku: 0,
shopId: uni.getStorageSync('shopId'),
...par
}])
uni.showToast({
@@ -202,34 +175,58 @@
emits('update')
}
let isPauseSale=ref(props.data.isPauseSale)
let isGrounding=ref(props.data.isGrounding)
watch(() => props.data.isPauseSale, (newval) => {
isPauseSale.value=newval
let isSoldStock=ref(props.data.isSoldStock)
let isSale=ref(props.data.isSale)
watch(() => props.data.isSoldStock, (newval) => {
isSoldStock.value=newval
})
watch(() => props.data.isGrounding, (newval) => {
isGrounding.value=newval
watch(() => props.data.isSale, (newval) => {
isSale.value=newval
})
async function isPauseSaleChange(e) {
/**
* 修改售罄
* @param {Object} e
*/
async function isSoldStockChange(e) {
const res=await hasPermission('允许售罄商品')
if(!res){
return
}
upDateGoods({
key: 'pauseSale',
value: isPauseSale.value?0:1
let res2 = await productMarkIsSoldOut({
id: props.data.id,
type: 'product',
isSoldOut: isSoldStock.value?0:1
})
uni.showToast({
title: '修改成功',
icon: 'none'
})
emits('update')
}
async function isGroundingChange(e) {
/**
* 修改上下价
* @param {Object} e
*/
async function isSaleChange(e) {
const res=await hasPermission('允许上下架商品')
if(!res){
return
}
upDateGoods({
key: 'grounding',
value: isGrounding.value?0:1
let res2 = await productOnOff({
id: props.data.id,
type: 'product',
isSale: isSale.value?0:1
})
uni.showToast({
title: '修改成功',
icon: 'none'
})
emits('update')
}
let checked = ref(false)