商品列表修改,商品修改去掉库存相关东西,增加退菜是否退库存的选项,分类增加退菜是否退库存的选项,店铺增加退菜退库存模式配置,增加退款退菜是否退库存弹窗,增加购物车重复物品提示弹窗

This commit is contained in:
2026-04-11 15:31:57 +08:00
parent bc7b6d41f5
commit 2db9f6811a
15 changed files with 3002 additions and 2373 deletions

View File

@@ -14,6 +14,16 @@ export function categoryPage(data, urlType = 'product') {
}
})
}
/**
* 获取分类详情
* @returns
*/
export function getCategoryDetail(id, urlType = 'product') {
return request({
url: `${urlType}/admin/prod/category/`+id,
method: "GET",
})
}
/**
* 分类添加

View File

@@ -14,7 +14,19 @@ export function getConsPage(data, urlType = 'product') {
}
})
}
/**
* 耗材库存列表接口
* @returns
*/
export function getConsStock(data, urlType = 'product') {
return request({
url: `${urlType}/admin/product/cons/consStock`,
method: "GET",
data: {
...data
}
})
}
/**
* 获取耗材列表
* @returns

View File

@@ -13,15 +13,22 @@
</view>
<view class="">
<uni-forms-item label="分类名称" required name="name">
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'"
:inputBorder="false" v-model="category.name" placeholder="输入分类名称" />
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
v-model="category.name" placeholder="输入分类名称" />
</uni-forms-item>
</view>
<view class="">
<uni-forms-item label="退菜是否退库存" required name=" refundMode">
<up-radio-group v-model="category.refundMode" placement="row">
<up-radio v-for="(item, index) in refundModes" :key="index" :label="item.name"
:name="item.value" activeColor="rgb(49, 138, 254)"></up-radio>
</up-radio-group>
</uni-forms-item>
</view>
<template v-if="option.type==='edit'">
<uni-forms-item label="排序" required name="sort">
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'"
:inputBorder="false" v-model="category.sort" type="number"
placeholder="排序越小越靠前" />
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
</uni-forms-item>
</template>
<uni-forms-item label="">
@@ -50,14 +57,35 @@
</template>
<script setup>
import { reactive, ref } from 'vue';
import {
reactive,
ref
} from 'vue';
import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js';
import mySwitch from '@/components/my-components/my-switch'
import myUploadFile from '@/components/my-components/my-upload-file'
import { onLoad, onReady } from '@dcloudio/uni-app';
import { addCategory, putCategory } from '@/http/api/cateGory.js'
import {
onLoad,
onReady
} from '@dcloudio/uni-app';
import {
addCategory,
putCategory
} from '@/http/api/cateGory.js'
const refundModes = [{
name: "退菜退库存",
value: 1
},
{
name: "仅退菜不退库存",
value: 2
},
{
name: "每次询问-退菜后弹窗提示",
value: 3
},
]
// 构造分类的基础数据
const category = reactive({
@@ -121,6 +149,7 @@
}
}
}
function validateFunc(key, value) {
if (validateFuncObj.hasOwnProperty(key)) {
const func = validateFuncObj[key]

View File

@@ -18,6 +18,12 @@
<view>预警值</view>
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
</view>
<view>
<view>是否检测耗材</view>
<up-switch size="20" :inactive-value="0" :active-value="1" v-model="datas.form.isStock"></up-switch>
</view>
<view v-if="!datas.form.id" style="justify-content: space-between">
<view>耗材类型</view>
<view style="width: 54%" @tap="datas.show = !datas.show">
@@ -55,7 +61,8 @@
<view class="label">默认入库单位</view>
<view class="ipt">
<u-radio-group v-model="datas.form.defaultUnit">
<u-radio :name="item" :label="item" v-for="(item, index) in unitList" :key="index"></u-radio>
<u-radio :name="item" :label="item" v-for="(item, index) in unitList"
:key="index"></u-radio>
</u-radio-group>
</view>
</view>
@@ -63,19 +70,30 @@
</view>
</template>
<view class="bottombutton">
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button>
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true"
text="保存"></up-button>
</view>
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false" @confirm="confirmConsGroup"></up-picker>
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false"
@confirm="confirmConsGroup"></up-picker>
<!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast>
<u-picker :show="unitShow" :columns="unitList"></u-picker>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import {
ref,
reactive
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
import {
getConsGrpupList,
addCons,
editCons
} from '@/http/api/cons.js';
let datas = reactive({
show: false,
@@ -87,7 +105,8 @@ let datas = reactive({
consGroupId: null,
conUnitTwo: '', // 第二单位
conUnitTwoConvert: '', // 第二单位转换数量
defaultUnit: ''
defaultUnit: '',
isStock: 1,
},
consGroupName: '',
typeList: []
@@ -148,9 +167,13 @@ let sumbit = async () => {
return;
}
if (!datas.form.id) {
await addCons({ ...datas.form });
await addCons({
...datas.form
});
} else {
await editCons({ ...datas.form });
await editCons({
...datas.form
});
}
uni.navigateBack();
};
@@ -191,7 +214,7 @@ page {
.df;
>view:first-child {
width: 190rpx;
width: 240rpx;
height: 84rpx;
line-height: 84rpx;
// text-align: left;
@@ -233,10 +256,12 @@ page {
display: flex;
align-items: center;
}
.tips-wrap {
--pColor: #e6a23c;
--iColor: #fdf6ec;
padding: 0 28upx;
.content {
display: flex;
align-items: center;
@@ -248,10 +273,12 @@ page {
flex-direction: column;
padding-left: 10px;
gap: 8upx;
.t1 {
font-size: 32upx;
color: var(--pColor);
}
.t2 {
font-size: 24upx;
color: var(--pColor);
@@ -259,13 +286,16 @@ page {
}
}
}
.form-wrap {
padding: 28upx 28upx 0;
.form {
padding: 28upx;
background-color: #fff;
border-radius: 16upx;
}
.row {
height: 84upx;
display: flex;
@@ -273,13 +303,16 @@ page {
align-items: center;
background-color: #fcfcfc;
padding: 0 20upx;
&:not(:last-child) {
margin-bottom: 28upx;
}
.label {
font-size: 32upx;
color: #333;
}
.ipt {
flex: 1;
}

View File

@@ -12,25 +12,25 @@
<view>
<view> <text style="color: red;">*</text> 入库时间 </view>
<view>
<up-datetime-picker
hasInput
v-model="datas.form.inOutDate"
mode="date"
></up-datetime-picker>
<up-datetime-picker hasInput v-model="datas.form.inOutDate" mode="date"></up-datetime-picker>
</view>
</view>
<view>
<view> <text style="color: red;">*</text> 入库数量 </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" @change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)" name="" id=""> </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber"
@change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)"
name="" id=""> </view>
</view>
<view>
<view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice"
@change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)"
name="" id=""> </view>
</view>
<view style="justify-content: space-between;">
<view> 单位 </view>
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id=""> </view>
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id="">
</view>
</view>
<view>
<view> 应付金额 </view>
@@ -43,7 +43,8 @@
<view style="justify-content: space-between;align-items: center;">
<view> 供应商 </view>
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}</view>
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}
</view>
</picker>
<uni-icons type="bottom" size="16"></uni-icons>
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
@@ -64,13 +65,24 @@
<script setup>
import { ref, computed, reactive } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import {
ref,
computed,
reactive
} from 'vue';
import {
onShow,
onLoad
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import dayjs from 'dayjs';
import { getVendorPage } from '@/http/api/vendor.js';
import { consStockIn } from '@/http/api/cons.js';
import {
getVendorPage
} from '@/http/api/vendor.js';
import {
consStockIn
} from '@/http/api/cons.js';
let showStatus = ref(false)
let datas = reactive({
@@ -157,10 +169,11 @@
datas.form.bodyList.conId = datas.item.id
datas.form.bodyList = [datas.form.bodyList]
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
consStockIn({
...datas.form,
// 供应商id
vendorId: datas.list[nowStatusIndex.value].id,
vendorId: datas.list[nowStatusIndex.value]?datas.list[nowStatusIndex.value].id:'',
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
}).then(res => {
uni.$utils.showToast("保存成功")
@@ -194,9 +207,11 @@
list-style: none;
padding: 0;
}
::v-deep.u-input {
border: none !important;
}
.status {
margin: 0 32rpx;
position: absolute;

View File

@@ -42,7 +42,7 @@ async function getProductListAjax() {
mask: true
});
const res = await getProductList();
list.value = res;
list.value = res.productList;
} catch (error) {
console.log(error);
}

View File

@@ -4,15 +4,16 @@
<my-tabs :list="tabsList" v-model="tabsCurrent"></my-tabs>
</up-sticky>
<view class="box">
<template v-if="tabsCurrent === 0">
<view class="basic">
<uni-forms :model="FormData" :rules="rules" :border="true" label-position="top" err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
<view class="basic" v-show="tabsCurrent === 0">
<uni-forms :model="FormData" :rules="rules" :border="true" label-position="top"
err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
<view class="block">
<view class="border-top-0 typeEnum">
<uni-forms-item label="商品类型" required showRequired>
<up-radio-group v-model="FormData.type" @change="changeFormDatatype">
<view style="display: flex; flex-wrap: wrap; justify-content: flex-start">
<view v-for="(item, index) in pageData.types" :key="index" style="margin-right: 30rpx">
<view v-for="(item, index) in pageData.types" :key="index"
style="margin-right: 30rpx">
<up-radio :label="item.name" :name="item.value"></up-radio>
</view>
</view>
@@ -23,65 +24,45 @@
<view class="" v-if="FormData.type === 'package'">
<uni-forms-item label="套餐商品">
<up-radio-group v-model="FormData.groupType" placement="row">
<up-radio
:custom-style="{ marginRight: '30px' }"
v-for="(item, index) in packageType.list"
:key="index"
:label="item.name"
:name="item.value"
></up-radio>
<up-radio :custom-style="{ marginRight: '30px' }"
v-for="(item, index) in packageType.list" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</uni-forms-item>
</view>
<uni-forms-item required name="name" label="商品名称" showRequired>
<uni-easyinput
:paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle"
:inputBorder="inputBorder"
v-model="FormData.name"
placeholder="请输入商品名称"
/>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
</uni-forms-item>
<uni-forms-item ref="fileItem" label="图片" required showRequired>
<my-upload-file ref="refFile" :images="FormData.images" :imageStyles="imageStyles"></my-upload-file>
<my-upload-file ref="refFile" :images="FormData.images"
:imageStyles="imageStyles"></my-upload-file>
<view class="u-m-t-16 color-999 u-font-24">:第一张图为商品封面图图片尺寸为750x750</view>
</uni-forms-item>
<view class="u-relative">
<uni-forms-item label="商品分类" required showRequired name="categoryId">
<uni-data-picker
:clear-icon="false"
:map="{ text: 'name', value: 'id' }"
placeholder="请选择商品分类"
popup-title="请选择商品分类"
:localdata="pageData.category"
v-model="FormData.categoryId"
></uni-data-picker>
<uni-data-picker :clear-icon="false" :map="{ text: 'name', value: 'id' }"
placeholder="请选择商品分类" popup-title="请选择商品分类" :localdata="pageData.category"
v-model="FormData.categoryId"></uni-data-picker>
</uni-forms-item>
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)" v-if="option.type == 'edit' && disabledChangeCategory"></view>
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)"
v-if="option.type == 'edit' && disabledChangeCategory"></view>
</view>
<view class="">
<uni-forms-item label="单位" required showRequired name="units">
<uni-data-picker
:clear-icon="false"
@change="unitIdChange"
:map="{ text: 'name', value: 'id' }"
placeholder="请选择单位"
popup-title="请选择单位"
:localdata="pageData.units"
v-model="FormData.unitId"
></uni-data-picker>
<uni-data-picker :clear-icon="false" @change="unitIdChange"
:map="{ text: 'name', value: 'id' }" placeholder="请选择单位" popup-title="请选择单位"
:localdata="pageData.units" v-model="FormData.unitId"></uni-data-picker>
</uni-forms-item>
</view>
<template v-if="FormData.type === 'package'">
<view class="border-top" v-if="FormData.proGroupVo">
<view
class=""
v-if="
<view class="" v-if="
(FormData.groupType == 1 && FormData.proGroupVo.length) ||
(FormData.groupType == 0 && FormData.proGroupVo.length && FormData.proGroupVo[0].goods.length)
"
>
<view class="border-bottom u-p-b-32" v-for="(item, index) in FormData.proGroupVo" :key="index">
">
<view class="border-bottom u-p-b-32"
v-for="(item, index) in FormData.proGroupVo" :key="index">
<view class="u-p-t-24" v-if="FormData.groupType == 1">
<view class="u-flex u-row-between">
<view class="u-flex">
@@ -90,14 +71,17 @@
</view>
<view class="u-flex color-999" @tap="delproGroupVo(index)">
<uni-icons type="minus-filled" :size="16" :color="$utils.ColorRed"></uni-icons>
<uni-icons type="minus-filled" :size="16"
:color="$utils.ColorRed"></uni-icons>
<view class="u-m-l-10">删除套餐组</view>
</view>
</view>
<view class="u-flex u-m-t-16">
<up-input v-model="item.title" placeholder="请输入套餐名称"></up-input>
<view class="u-flex color-main u-font-24 u-m-l-24" @click="proGroupVoAddGoods(index, item.goods)">
<up-icon name="plus" :size="12" :color="$utils.ColorMain"></up-icon>
<view class="u-flex color-main u-font-24 u-m-l-24"
@click="proGroupVoAddGoods(index, item.goods)">
<up-icon name="plus" :size="12"
:color="$utils.ColorMain"></up-icon>
<view class="font-bold">添加商品</view>
</view>
</view>
@@ -113,19 +97,25 @@
<view class="u-p-r-40">数量</view>
</view>
</view>
<view class="u-flex row u-p-24 u-row-between" v-for="(product, goodsIndex) in item.goods" :key="goodsIndex">
<view class="u-flex row u-p-24 u-row-between"
v-for="(product, goodsIndex) in item.goods" :key="goodsIndex">
<view class="u-flex u-flex-1">
<view class=" ">
{{ product.name || product.proName }}
</view>
</view>
<view class="u-flex u-row-center u-flex-1">
<view @click="refChooseGuigeOpen(product.skuList, index, goodsIndex)" class="">
<template v-if="!product.skuName && product.type == 'sku'">
<up-button type="primary" size="mini">设置规格</up-button>
<view
@click="refChooseGuigeOpen(product.skuList, index, goodsIndex)"
class="">
<template
v-if="!product.skuName && product.type == 'sku'">
<up-button type="primary"
size="mini">设置规格</up-button>
</template>
<template v-else>
<text class="color-main">{{ product.skuName }}</text>
<text
class="color-main">{{ product.skuName }}</text>
</template>
</view>
</view>
@@ -136,7 +126,8 @@
</view>
<view class="u-flex u-text-right u-flex-1 u-row-right">
<view class="u-flex u-p-r-30">
<up-number-box :button-size="14" integer v-model="product.number">
<up-number-box :button-size="14" integer
v-model="product.number">
<template #minus>
<view class="minus">
<up-icon name="minus" size="12"></up-icon>
@@ -149,7 +140,9 @@
</template>
</up-number-box>
</view>
<up-icon @click="proGroupVoGoodsDel(index, goodsIndex)" size="14" name="trash" :color="$utils.ColorMain"></up-icon>
<up-icon @click="proGroupVoGoodsDel(index, goodsIndex)"
size="14" name="trash"
:color="$utils.ColorMain"></up-icon>
</view>
</view>
</view>
@@ -160,20 +153,24 @@
<text class="font-bold">几选几</text>
</view>
<view class="u-flex u-m-t-16">
<uni-number-box :min="1" :max="item.goods.length" :width="200" v-model="item.number" placeholder="几选几"></uni-number-box>
<uni-number-box :min="1" :max="item.goods.length" :width="200"
v-model="item.number" placeholder="几选几"></uni-number-box>
</view>
</template>
</view>
</view>
<template v-if="FormData.groupType == 1">
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12" @tap="proGroupVoPush">
<uni-icons type="plus-filled" :color="$utils.ColorMain" :size="20"></uni-icons>
<uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加套餐组</view>
</view>
</template>
<template v-else>
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12" @tap="proGroupVoAddGoods()">
<uni-icons type="plus-filled" :color="$utils.ColorMain" :size="20"></uni-icons>
<view class="bg-fff u-flex u-p-t-24 u-p-b-24 border-r-12"
@tap="proGroupVoAddGoods()">
<uni-icons type="plus-filled" :color="$utils.ColorMain"
:size="20"></uni-icons>
<view class="u-m-l-16">添加商品</view>
</view>
</template>
@@ -182,13 +179,8 @@
<view class="">
<uni-forms-item label="商品描述">
<uni-easyinput
:paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle"
type="textarea"
v-model="FormData.shortTitle"
placeholder="请填写商品简述"
/>
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
</uni-forms-item>
</view>
</view>
@@ -222,7 +214,8 @@
<text>原价</text>
</view>
<view class="u-m-t-16">
<price-number-box placeholder="请输入原价" v-model="sku.originPrice"></price-number-box>
<price-number-box placeholder="请输入原价"
v-model="sku.originPrice"></price-number-box>
</view>
</view>
<view class="u-flex-1">
@@ -231,7 +224,8 @@
<text>售价</text>
</view>
<view class="u-m-t-16">
<price-number-box placeholder="请输入售价" v-model="sku.salePrice"></price-number-box>
<price-number-box placeholder="请输入售价"
v-model="sku.salePrice"></price-number-box>
</view>
</view>
</view>
@@ -242,7 +236,8 @@
<text>会员价</text>
</view>
<view class="u-m-t-16">
<price-number-box placeholder="请输入会员价(元)" v-model="sku.memberPrice"></price-number-box>
<price-number-box placeholder="请输入会员价(元)"
v-model="sku.memberPrice"></price-number-box>
</view>
</view>
<view class="u-flex-1">
@@ -251,7 +246,8 @@
<text>成本价</text>
</view>
<view class="u-m-t-16">
<price-number-box placeholder="请输入成本价" v-model="sku.costPrice"></price-number-box>
<price-number-box placeholder="请输入成本价"
v-model="sku.costPrice"></price-number-box>
</view>
</view>
</view>
@@ -261,7 +257,8 @@
<text>起售数量</text>
</view>
<view class="u-m-t-16">
<price-number-box inputType="number" placeholder="请输入起售数量" v-model="sku.suitNum"></price-number-box>
<price-number-box inputType="number" placeholder="请输入起售数量"
v-model="sku.suitNum"></price-number-box>
</view>
</view>
<view class="u-m-t-24">
@@ -314,11 +311,12 @@
<uni-forms-item label="">
<view class="u-flex u-row-between">
<view class="label-title">上架</view>
<my-switch disabled :openDisabledClass="false" @click="isGroundingChange" v-model="FormData.isSale"></my-switch>
<my-switch disabled :openDisabledClass="false" @click="isGroundingChange"
v-model="FormData.isSale"></my-switch>
</view>
</uni-forms-item>
</view>
<uni-forms-item label="">
<!-- <uni-forms-item label="">
<view class="u-flex u-row-between">
<view class="label-title">库存开关</view>
<my-switch v-model="FormData.isStock"></my-switch>
@@ -341,7 +339,7 @@
</uni-forms-item>
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)"></view>
</view>
</template>
</template> -->
<uni-forms-item label="">
<view class="u-flex u-row-between">
@@ -351,33 +349,51 @@
</uni-forms-item>
<uni-forms-item label="打包费">
<uni-easyinput
@blur="priceFormat(FormData, 'packFee')"
:paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle"
:inputBorder="inputBorder"
v-model="FormData.packFee"
type="digit"
placeholder="请输入打包费"
/>
<uni-easyinput @blur="priceFormat(FormData, 'packFee')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.packFee" type="digit"
placeholder="请输入打包费" />
</uni-forms-item>
<template v-if="option.type === 'edit'">
<uni-forms-item label="排序">
<uni-easyinput
@blur="priceFormat(FormData, 'sort')"
:paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle"
:inputBorder="inputBorder"
v-model="FormData.sort"
type="digit"
placeholder="请输入排序"
/>
<uni-easyinput @blur="priceFormat(FormData, 'sort')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="FormData.sort" type="digit"
placeholder="请输入排序" />
</uni-forms-item>
</template>
<uni-forms-item label="关联推荐商品">
<view class="tips">
</view>
</template>
</uni-forms>
<view style="height: 100rpx"></view>
<view style="padding-left: 110rpx; padding-right: 110rpx" class="u-m-t-20"
v-if="option.type === 'edit'" @click="delModelShow">
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
<view class="color-red">删除该商品</view>
</my-button>
</view>
<view class="bootom">
<view class="save-btn-box">
<my-button fontWeight="700" shape="circle" @tap="save">保存</my-button>
</view>
</view>
</view>
<template v-if="tabsCurrent === 1">
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData"
v-model:isAutoSoldStock="FormData.isAutoSoldStock"
v-model:refundMode="FormData.refundMode"
@cancel="changeTabsCurrent(0)"></edit-haocai>
</template>
<template v-if="tabsCurrent === 2">
<view class="link-goods">
<view class="font-bold">关联推荐商品</view>
<view class="tips u-m-t-10">
<text class="t">设置商品后,用户可以在商品详情页中看到推荐商品,最多设置{{ goodsListMax }}个商品</text>
</view>
<view class="table">
@@ -403,7 +419,8 @@
<text class="t">{{ item.name }}</text>
</view>
<view class="td">
<u-text type="error" text="删除" @click="FormData.relatedRecommendJson.splice(index, 1)"></u-text>
<u-text type="error" text="删除"
@click="FormData.relatedRecommendJson.splice(index, 1)"></u-text>
</view>
</view>
<view class="table-tips" v-if="!FormData.relatedRecommendJson.length">
@@ -413,48 +430,47 @@
</view>
<view class="add-goods" v-if="FormData.relatedRecommendJson.length < goodsListMax">
<view class="btn">
<u-text type="primary" text="添加商品" prefixIcon="plus" iconStyle="color:#409EFF;" @click="toSelectGoodsPage"></u-text>
</view>
</view>
</uni-forms-item>
</view>
</template>
</uni-forms>
<view style="height: 100rpx"></view>
<view style="padding-left: 110rpx; padding-right: 110rpx" class="u-m-t-20" v-if="option.type === 'edit'" @click="delModelShow">
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
<view class="color-red">删除该商品</view>
</my-button>
</view>
<view class="bootom">
<view class="save-btn-box">
<my-button fontWeight="700" shape="circle" @tap="save">保存</my-button>
<u-text type="primary" text="添加商品" prefixIcon="plus" iconStyle="color:#409EFF;"
@click="toSelectGoodsPage"></u-text>
</view>
</view>
</view>
</template>
<template v-if="tabsCurrent === 1">
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
</template>
</view>
<!-- 删除弹窗 -->
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除"></my-model>
<!-- 选择商品 -->
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm" :category="pageData.category"></choose-goods>
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm"
:category="pageData.category"></choose-goods>
<!-- 选择规格 -->
<choose-guige ref="refChooseGuige" @confirm="refChooseGuigeConfirm"></choose-guige>
</view>
</template>
<script setup>
import { computed, onBeforeUnmount, reactive, ref, watch, nextTick } from 'vue';
import { onLoad, onShow, onReady } from '@dcloudio/uni-app';
import {
computed,
onBeforeUnmount,
reactive,
ref,
watch,
nextTick
} from 'vue';
import {
onLoad,
onShow,
onReady
} from '@dcloudio/uni-app';
import dayjs from 'dayjs';
import { formatPrice } from '@/commons/utils/format.js';
import {
formatPrice
} from '@/commons/utils/format.js';
import go from '@/commons/utils/go.js';
import linkGoods from './components/link-goods.vue';
import chooseGoods from './components/choose-goods';
import chooseGuige from './components/choose-guige';
import editHaocai from './components/edit-haocai.vue';
@@ -463,12 +479,26 @@ import priceNumberBox from './components/price-number-box';
import infoBox from '@/commons/utils/infoBox.js';
import { hasPermission } from '@/commons/utils/hasPermission.js';
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import { $defaultSku } from '@/commons/goodsData.js';
import {
$defaultSku
} from '@/commons/goodsData.js';
import { getCategoryList, getProdUnitList, getProductDetail, addProduct, updateProduct, delProduct, productBindCons } from '@/http/api/product.js';
import { uploadFile } from '@/http/api/index.js';
import {
getCategoryList,
getProdUnitList,
getProductDetail,
addProduct,
updateProduct,
delProduct,
productBindCons
} from '@/http/api/product.js';
import {
uploadFile
} from '@/http/api/index.js';
const imageStyles = reactive({
width: 82,
@@ -518,7 +548,9 @@ function getLocalSelectGoods() {
});
return;
}
FormData.relatedRecommendJson.push({ ...res });
FormData.relatedRecommendJson.push({
...res
});
}
uni.setStorageSync('packageSelectGoods', '');
}
@@ -551,7 +583,8 @@ const FormData = reactive({
packFee: 0, //打包费
sort: 1, //排序值
specName: '', //规格模版名称
isAutoSoldStock:0,
isRefundStock:1,
unitName: '',
specificationsGroup: '',
relatedRecommendJson: [] // 关联商品
@@ -559,8 +592,7 @@ const FormData = reactive({
//页面全部数据
const pageData = reactive({
// 商品类型
types: [
{
types: [{
name: '单规格商品',
value: 'single'
},
@@ -589,12 +621,10 @@ const pageData = reactive({
skuList: []
});
const skuList = reactive({
list: [
{
list: [{
...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
}
]
}]
});
let $goodsData = {};
@@ -619,12 +649,10 @@ watch(
}
} else {
if (newval != 'sku') {
skuList.list = [
{
skuList.list = [{
...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
}
];
}];
} else {
skuList.list = [];
}
@@ -635,12 +663,10 @@ watch(
} else {
FormData.specId = '';
if (newval != 'sku') {
skuList.list = [
{
skuList.list = [{
...$defaultSku,
barCode: `${uni.getStorageSync('shopId')}${dayjs().valueOf()}`
}
];
}];
} else {
skuList.list = [];
}
@@ -920,7 +946,15 @@ function refChooseGoodsClose() {
function refChooseGoodsConfirm(arr) {
refChooseGoodsClose();
arr = arr.map((v) => {
const { proId, id, name, unitName, lowPrice, type, skuList } = v;
const {
proId,
id,
name,
unitName,
lowPrice,
type,
skuList
} = v;
if (proId) {
return v;
}
@@ -979,8 +1013,7 @@ function priceFormat(item, key) {
* 套餐商品类型
*/
const packageType = reactive({
list: [
{
list: [{
name: '固定套餐',
value: 0
},
@@ -992,14 +1025,13 @@ const packageType = reactive({
sel: 0
});
const tabsList = ['基础设置', '耗材绑定'];
const tabsList = ['基础设置', '耗材设置', '关联推荐商品'];
let tabsCurrent = ref(0);
const Forms = ref(null);
const delModel = ref(null);
const rules = {
images: {
rules: [
{
rules: [{
validateFunction: function(rule, value, data, callback) {
console.log(value);
if (value.length < 1) {
@@ -1007,12 +1039,10 @@ const rules = {
}
return true;
}
}
]
}]
},
name: {
rules: [
{
rules: [{
required: true,
errorMessage: '请输入商品名称'
},
@@ -1024,20 +1054,16 @@ const rules = {
]
},
categoryId: {
rules: [
{
rules: [{
required: true,
errorMessage: '请选择商品分类'
}
]
}]
},
floorPrice: {
rules: [
{
rules: [{
required: true,
errorMessage: '请填写商品底价'
}
]
}]
}
};
@@ -1065,7 +1091,8 @@ function delmodelConfirm() {
}
function updateGoodsDetail() {
getGoodsDetail();
// getGoodsDetail();
save()
}
let timer = null;
@@ -1087,7 +1114,10 @@ async function save() {
Forms.value
.validate()
.then((res) => {
const { groupType, type } = FormData;
const {
groupType,
type
} = FormData;
const images = refFile.value.getFileList();
if (images.length <= 0) {
@@ -1286,14 +1316,12 @@ function returnTimerTimeText() {
}
function initDefaultProGroupVo() {
FormData.proGroupVo = [
{
FormData.proGroupVo = [{
title: '',
count: 1,
number: 1,
goods: []
}
];
}];
console.log(FormData.proGroupVo);
}
@@ -1362,6 +1390,7 @@ page {
font-size: 28upx;
color: #999;
}
.barCode {
border: 1px solid #e5e5e5;
border-radius: 8rpx 8rpx 8rpx 8rpx;
@@ -1441,11 +1470,9 @@ page {
z-index: 9;
}
.minus {
}
.minus {}
.plus {
}
.plus {}
.box {
margin-top: 32rpx;
@@ -1480,6 +1507,32 @@ page {
color: #333;
}
.link-goods {
background-color: #fff;
padding: 32rpx 20rpx;
}
::v-deep .link-goods .uni-forms-item {
align-items: inherit;
}
::v-deep .link-goods .typeEnum .u-radio-group--row {
flex-wrap: nowrap;
justify-content: space-between;
}
::v-deep .link-goods .typeEnum .u-checkbox-group--row {
flex-wrap: nowrap;
justify-content: space-between;
}
::v-deep .link-goods .uni-forms-item .uni-forms-item__label {
text-indent: 0;
font-size: 28rpx !important;
font-weight: bold;
color: #333;
}
::v-deep .stock .uni-forms-item {
min-height: initial !important;
}
@@ -1618,48 +1671,60 @@ page {
}
}
}
.table {
border: 1px solid #ececec;
margin-top: 28upx;
.table-tips {
padding: 28upx;
display: flex;
justify-content: center;
.t {
font-size: 28upx;
color: #999;
}
}
.tabhead {
background-color: #f8f8f8;
border-bottom: 1px solid #ececec;
.t {
font-weight: bold;
}
}
.tr {
display: flex;
&:not(:last-child) {
border-bottom: 1px solid #ececec;
}
.td {
flex: 1;
min-height: 80upx;
display: flex;
align-items: center;
padding: 20upx;
&:not(:last-child) {
border-right: 1px solid #ececec;
}
&:nth-child(2) {
flex: 2;
}
.cover {
$size: 80upx;
width: $size;
height: $size;
border-radius: 8upx;
}
.t {
font-size: 28upx;
color: #333;
@@ -1667,6 +1732,7 @@ page {
}
}
}
.add-goods {
display: flex;
justify-content: center;

View File

@@ -1,6 +1,7 @@
<template>
<view>
<view class="default-box-padding bg-fff border-r-18">
<view class="font-bold u-m-b-32">绑定耗材</view>
<view class="u-flex u-row-between">
<view>商品名称</view>
</view>
@@ -58,8 +59,25 @@
</view>
</view>
<view class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32">
<view>当某个耗材的使用库存不足时商品自动售罄</view>
<view class="default-box-padding bg-fff border-r-18 u-m-t-32">
<view class="up-border-bottom u-p-b-32">
<view class="u-flex u-row-between ">
<view class="font-bold"> 自动售罄</view>
<up-switch :size="16" v-model="isAutoSoldStock" :inactive-value="0" :active-value="1"></up-switch>
</view>
<view class=" u-m-t-10">当某个耗材的使用库存不足时商品自动售罄</view>
</view>
<view class=" u-p-t-32">
<view class="">
<view class="font-bold u-m-b-16"> 退菜是否退库存</view>
<up-radio-group v-model="refundMode">
<up-radio v-for="(item,index) in tuiStockTypes" :key="index" :label="item.label"
:name="item.key"></up-radio>
</up-radio-group>
<view class="color-red u-m-t-10">当前店铺退菜退库存规则跟随商品分类</view>
</view>
</view>
</view>
<view class="bottom">
@@ -72,15 +90,42 @@
</template>
<script setup>
import { ref, reactive, watch, computed, onMounted } from 'vue';
import {
ref,
reactive,
watch,
computed,
onMounted
} from 'vue';
import infoBox from '@/commons/utils/infoBox.js'
import chooseHaocai from './choose-haocai.vue';
import chooseDanwei from './choose-danwei.vue';
import { hasPermission } from '@/commons/utils/hasPermission.js';
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import { getConsList } from '@/http/api/cons.js';
import { productBindCons } from '@/http/api/product.js';
import {
getConsList
} from '@/http/api/cons.js';
import {
productBindCons
} from '@/http/api/product.js';
const tuiStockTypes = ref([{
label: '退菜退库存',
key: 1
},
{
label: '仅退菜不退库存',
key: 2
},
{
label: '每次询问-退菜后弹窗提示,可手动选择',
key: 3
},
])
const isAutoSoldStock=defineModel('isAutoSoldStock',0)
const refundMode=defineModel('refundMode',1)
const emits = defineEmits(['cancel', 'updateGoods'])
@@ -91,7 +136,9 @@
return {
consList: [],
skuList: [],
type: ''
type: '',
isAutoSoldStock:0,
isRefundStock:1,
}
}
}
@@ -105,6 +152,7 @@
let $haocaiMap = reactive({})
const skuList = ref(props.goods.skuList)
const consList = ref(props.goods.consList || [])
watch(() => props.goods.consList, (newval) => {
consList.value = newval
})
@@ -207,7 +255,6 @@
emits('updateGoods')
infoBox.showToast('修改成功')
}
</script>
<style lang="scss" scoped>

View File

@@ -0,0 +1,11 @@
<template>
<view>
<view></view>
</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>

View File

@@ -6,10 +6,10 @@
<text class="">排序</text>
<text class="u-m-l-20">{{data.sort}}</text>
</view>
<view class="color-333 u-m-l-42 u-flex">
<!-- <view class="color-333 u-m-l-42 u-flex">
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
<up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon>
</view>
</view> -->
</view>
<view>
<!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->

View File

@@ -3,39 +3,30 @@
<view class="page-cell">
<view class="label">头像</view>
<view class="right">
<up-avatar
class="fileImg"
:src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''"
mode="aspectFill"
></up-avatar>
<up-avatar class="fileImg" :src="vdata.shopInfo.coverImg ? vdata.shopInfo.coverImg : ''"
mode="aspectFill"></up-avatar>
<view class="file" @tap="chooseAndUploadAvatar('coverImg')"></view>
</view>
</view>
<!-- <view class="page-cell m" @tap="updateValue('商户名称','shopName',vdata.shopInfo.shopName)"> -->
<view
class="page-cell m"
@tap="
<view class="page-cell m" @tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'shopName',
value: vdata.shopInfo.shopName,
})
"
>
">
<view class="label">商户名称</view>
<view class="right">
<view>{{ vdata.shopInfo.shopName }}</view>
<up-icon name="arrow-right" color="#999999" size="15"></up-icon>
</view>
</view>
<view
class="page-cell m"
@tap="
<view class="page-cell m" @tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'phone',
value: vdata.shopInfo.phone,
})
"
>
">
<view class="label">商户电话</view>
<view class="right">
<view>{{ vdata.shopInfo.phone }}</view>
@@ -49,14 +40,8 @@
<view class="page-cell m">
<view class="label">营业状态</view>
<view class="right">
<up-switch
v-model="vdata.shopInfo.status"
size="20"
:inactiveValue="2"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('status')"
></up-switch>
<up-switch v-model="vdata.shopInfo.status" size="20" :inactiveValue="2" :activeValue="1"
activeColor="#0FC161" @change="switchChange('status')"></up-switch>
</view>
</view>
<view class="page-cell m" @tap="showMap">
@@ -72,58 +57,31 @@
</view> -->
<view class="page-cell">
<view class="label">允许打包</view>
<view class="right"
><up-switch
v-model="vdata.takeout"
size="20"
activeColor="#0FC161"
@change="switchChange('eatModel')"
></up-switch
></view>
<view class="right"><up-switch v-model="vdata.takeout" size="20" activeColor="#0FC161"
@change="switchChange('eatModel')"></up-switch></view>
</view>
<view class="page-cell m">
<view class="label">是否开启会员余额支付</view>
<view class="right">
<up-switch
v-model="vdata.shopInfo.isAccountPay"
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isAccountPay')"
></up-switch>
<up-switch v-model="vdata.shopInfo.isAccountPay" size="20" :inactiveValue="0" :activeValue="1"
activeColor="#0FC161" @change="switchChange('isAccountPay')"></up-switch>
</view>
</view>
<view class="page-cell m">
<view class="label">是否开启数签子</view>
<view class="right">
<up-switch
v-model="vdata.shopInfo.isCountStick"
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isCountStick')"
></up-switch>
<up-switch v-model="vdata.shopInfo.isCountStick" size="20" :inactiveValue="0" :activeValue="1"
activeColor="#0FC161" @change="switchChange('isCountStick')"></up-switch>
</view>
</view>
<view class="page-cell m" style="display: block">
<view class="u-flex u-row-between">
<view class="label">点餐电子围栏</view>
<view class="right"
><up-switch
v-model="vdata.shopInfo.isOrderFence"
size="20"
:inactiveValue="0"
:activeValue="1"
activeColor="#0FC161"
@change="switchChange('isOrderFence')"
></up-switch
></view>
<view class="right"><up-switch v-model="vdata.shopInfo.isOrderFence" size="20" :inactiveValue="0"
:activeValue="1" activeColor="#0FC161" @change="switchChange('isOrderFence')"></up-switch>
</view>
<view class="u-m-t-6 color-666 u-font-24"
>开启后用户只能在店铺附近两公里范围内点餐</view
>
</view>
<view class="u-m-t-6 color-666 u-font-24">开启后用户只能在店铺附近两公里范围内点餐</view>
</view>
<!-- <view class="page-cell m">
@@ -142,29 +100,20 @@
<view class="page-cell">
<view class="label">
桌位费
<view
v-if="!vdata.isTableFee"
class="tableFee"
@tap="
<view v-if="!vdata.isTableFee" class="tableFee" @tap="
go.to('PAGES_SHOP_EDITVAL', {
name: 'tableFee',
value: vdata.shopInfo.tableFee,
})
"
>
">
{{ vdata.shopInfo.tableFee }}
</view>
</view>
<view class="right">
<view>
<up-checkbox-group>
<up-checkbox
label="免桌位费"
v-model:checked="vdata.isTableFee"
activeColor="#0FC161"
shape="circle"
@change="isTableFeeChange"
></up-checkbox>
<up-checkbox label="免桌位费" v-model:checked="vdata.isTableFee" activeColor="#0FC161"
shape="circle" @change="isTableFeeChange"></up-checkbox>
</up-checkbox-group>
</view>
</view>
@@ -186,45 +135,74 @@
</view>
</view> -->
<view class="page-cell m">
<view class="page-cell">
<view class="label">付费模式</view>
<view class="right">
<up-radio-group v-model="vdata.shopInfo.registerType" placement="row">
<up-radio
:customStyle="{ marginRight: '10px' }"
v-for="(item, index) in vdata.registerTypeList"
:key="index"
:label="item.name"
:name="item.value"
activeColor="#0FC161"
@change="radioChange"
></up-radio>
<up-radio :customStyle="{ marginRight: '10px' }" v-for="(item, index) in vdata.registerTypeList"
:key="index" :label="item.name" :name="item.value" activeColor="#0FC161"
@change="radioChange"></up-radio>
</up-radio-group>
</view>
</view>
<view
class="page-cell"
@tap="
<view class="page-cell m">
<view class="label">退菜退库存模式</view>
<view class="right">
<up-radio-group v-model="vdata.shopInfo.refundMode" placement="row">
<up-radio v-for="(item, index) in vdata.refund_modes" :key="index" :label="item.name"
:name="item.value" activeColor="#0FC161" @change="refundModeChange"></up-radio>
</up-radio-group>
</view>
</view>
<view class="page-cell" @tap="
go.to('PAGES_SHOP_QRCODE', {
paymentQrcode: vdata.shopInfo.paymentQrcode,
})
"
>
">
<view class="label">店铺收款码</view>
<view class="right"
><up-icon name="arrow-right" color="#999999" size="15"></up-icon
></view>
<view class="right"><up-icon name="arrow-right" color="#999999" size="15"></up-icon></view>
</view>
<!-- <view class="cutShop" @tap="go.to('PAGES_SHOP_LIST')">切换门店</view> -->
<up-modal :show="refundMode.show" title="提示" asyncClose android-*=""
showCancelButton
@close="refundMode.show=false"
@cancel="refundModeCancel"
@confirm="refundModeConfirm"
>
<view>
<view class="u-font-28">
<text>当前操作退菜退库存模式切换为</text>
<text class="color-red">{{refundMode.mode}}</text>
</view>
<view class="u-font-28 color-666 u-m-t-12">
<text class="">修改后可前往商品管理-商品分类中编辑/查看配置</text>
</view>
<view class="u-m-t-40 u-font-28 color-red">
本操作将会影响耗材库存数量的统计请谨慎操作
</view>
</view>
</up-modal>
</view>
</template>
<script setup>
import { ref, reactive, onMounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
import {
ref,
reactive,
onMounted
} from "vue";
import {
onShow
} from "@dcloudio/uni-app";
import go from "@/commons/utils/go.js";
import { uploadFile } from "@/http/api/index.js";
import {
uploadFile
} from "@/http/api/index.js";
import {
getShopInfo,
editShopInfo,
@@ -232,6 +210,31 @@ import {
editShopExtend,
} from "@/http/api/shop.js";
const refundMode = reactive({
show: false,
mode: ''
})
function refundModeCancel(){
vdata.shopInfo.refundMode=vdata.shopInfo.refundMode==1?2:1
refundMode.show = false
}
function refundModeConfirm(){
let params = {
id: vdata.shopInfo.id,
refundMode: vdata.shopInfo.refundMode,
};
updateShopInfo(params);
refundMode.show = false
}
function refundModeChange(e) {
console.log(e);
const item = vdata.refund_modes.find(v => v.value == e)
if (item) {
refundMode.mode = item.name
}
refundMode.show = true
}
const vdata = reactive({
shopInfo: {
status: 2,
@@ -239,9 +242,23 @@ const vdata = reactive({
isMemberPrice: 0,
},
extendList: [],
registerTypeList: [
{ name: "先付费", value: "before" },
{ name: "后付费", value: "after" },
registerTypeList: [{
name: "先付费",
value: "before"
},
{
name: "后付费",
value: "after"
},
],
refund_modes: [{
name: "跟随商品分类",
value: 1
},
{
name: "跟随单商品",
value: 2
},
],
extendIndex: 0,
extendInfo: {},
@@ -281,7 +298,9 @@ let refreshData = (e) => {
* 获取店铺信息
*/
const shopInfo = () => {
getShopInfo({ id: uni.getStorageSync("shopInfo").id }).then((res) => {
getShopInfo({
id: uni.getStorageSync("shopInfo").id
}).then((res) => {
vdata.isTableFee = res.isTableFee == 1 ? true : false;
if (res.eatModel.split(",").indexOf("dine-in") != -1) {
vdata.dineIn = true;
@@ -326,6 +345,7 @@ let radioChange = (n) => {
updateShopInfo(params);
};
/**
* 修改
*/
@@ -499,6 +519,7 @@ let showMap = () => {
.page-wrapper {
background-color: #f8f8f8;
padding-bottom: 32rpx;
.page-cell {
display: flex;
justify-content: space-between;
@@ -506,6 +527,7 @@ let showMap = () => {
padding: 32rpx 28rpx;
box-sizing: border-box;
background-color: #fff;
.label {
font-weight: bold;
font-size: 28rpx;
@@ -514,6 +536,7 @@ let showMap = () => {
align-items: center;
flex-shrink: 0;
margin-right: 20rpx;
.tableFee {
width: 186rpx;
height: 54rpx;
@@ -528,14 +551,17 @@ let showMap = () => {
box-sizing: border-box;
}
}
.extendList {
width: 100%;
display: flex;
flex-direction: column;
margin-top: 24rpx;
.extendTab {
display: flex;
justify-content: flex-start;
.extendTab_item {
font-size: 24rpx;
font-weight: 400;
@@ -544,21 +570,25 @@ let showMap = () => {
border: 2rpx solid #e5e5e5;
margin-right: 20rpx;
}
.active {
background: #318afe;
border: 2rpx solid #318afe;
color: #fff;
}
}
.extend_content {
display: flex;
margin-top: 32rpx;
.preview {
min-width: 146rpx;
height: 342rpx;
position: relative;
margin-right: 32rpx;
background-color: #f7f7f7;
::v-deep .bg,
::v-deep .bg .u-image,
::v-deep .bg .u-image__image {
@@ -603,6 +633,7 @@ let showMap = () => {
position: absolute;
top: 0;
}
::v-deep .bg.ticket_logo,
::v-deep .bg.ticket_logo .u-image,
::v-deep .bg.ticket_logo .u-image__image {
@@ -611,6 +642,7 @@ let showMap = () => {
position: absolute;
top: 0;
}
::v-deep .ticket_logo.img .u-image,
::v-deep .ticket_logo.img .u-image__image {
width: 146rpx !important;
@@ -628,19 +660,23 @@ let showMap = () => {
background-color: #fff;
}
}
.extend_img {
display: flex;
flex-direction: column;
.extend_title {
font-weight: 400;
font-size: 24rpx;
color: #333333;
margin-bottom: 16rpx;
}
.fileUp {
width: 148rpx;
height: 148rpx;
position: relative;
.file {
width: 148rpx;
height: 148rpx;
@@ -648,6 +684,7 @@ let showMap = () => {
top: 0;
}
}
::v-deep .u-image,
::v-deep .u-image__image {
width: 148rpx !important;
@@ -657,15 +694,19 @@ let showMap = () => {
}
}
}
.column {
flex-direction: column;
.label {
align-self: flex-start;
}
}
.m {
margin-bottom: 12rpx;
}
.cutShop {
width: 530rpx;
height: 80rpx;
@@ -701,6 +742,7 @@ let showMap = () => {
.fileImg {
width: 112rpx !important;
height: 112rpx !important;
::v-deep .u-avatar__image {
width: 112rpx !important;
height: 112rpx !important;
@@ -708,4 +750,8 @@ let showMap = () => {
}
}
}
.color-red {
color: red;
}
</style>

View File

@@ -3,7 +3,9 @@
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
<view class="info u-flex u-row-between u-col-top u-flex-col">
<view class="limit-discount" v-if="is_time_discount">限时折扣</view>
<view class="nowStockerNumber" v-if="nowStockerNumber<=10">
剩余库存{{nowStockerNumber}}
</view>
<view>
<view>
<text class="up-line-1">{{ data.name }}</text>
@@ -56,7 +58,7 @@
<view class="isSellout" v-else-if="data.isSoldStock == 1">
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image>
</view>
<view class="isSellout" v-else-if="data.isStock == 1 && data.stockNumber <= 0">
<view class="isSellout" v-else>
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-stock.svg" mode=""></image>
</view>
</template>
@@ -107,6 +109,10 @@
return {};
},
},
consStockList: {
type: Array,
default:[]
}
});
//判断是否是时间折扣商品
@@ -156,12 +162,64 @@
return false;
}
return (
(item.isStock == 1 && item.stockNumber <= 0) ||
!consStockisFull(item) ||
item.isSoldStock == 1 ||
item.isSale == 0 ||
!isProductAvailable(item.days, item.startTime, item.endTime)
);
});
const stockNumber=computed(()=>{
})
// 1. 筛选匹配的耗材列表
const conslist=computed(()=>{
if(props.consStockList.length<=0){
return []
}
return props.consStockList.filter(v => {
return props.data.consList.find(i =>{
return i.consInfoId == v.consId
});
});
})
// 2. 找到 stockNumber 最小的那一项
const minConsItem=computed(()=>{
if(conslist.value.length<=0){
return null
}
return conslist.value.reduce((prev, current) => {
return prev.stockNumber < current.stockNumber ? prev : current;
});
})
// 3. 找到和 minItem 的 consId 一样的那个消耗配置项
const targetCons=computed(()=>{
if(!minConsItem.value){
return null
}
return props.data.consList.find(i => i.consInfoId == minConsItem.value.consId);
})
const nowStockerNumber=computed(()=>{
if(!targetCons.value||!minConsItem.value){
return 9999
}
return Math.floor(minConsItem.value.stockNumber/targetCons.value.surplusStock)
})
function consStockisFull(item) {
// 无数据直接返回 true或按你需求返回 false
if (!conslist.value.length) return true;
if(!minConsItem.value)return true;
if(!targetCons.value) return true;
// 4. 判断:最小库存 > 每份消耗库存 → 返回 true否则 false
if (nowStockerNumber.value>=1) {
return true;
} else {
return false;
}
}
// 判断商品是否在可售时间内
function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) {
// 将后端返回的字符串转换为数组
@@ -306,4 +364,14 @@
color: rgba(255, 255, 255, 0.8);
text-decoration: line-through;
}
.nowStockerNumber{
position: absolute;
left: 24rpx;
bottom: 80rpx;
background-color: rgba(255, 255, 255, .8);
color: red;
padding: 4rpx 8rpx;
font-size: 24rpx;
border-radius: 4rpx ;
}
</style>

View File

@@ -36,9 +36,7 @@
</view>
</scroll-view>
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
@scroll="rightScroll"
@scrolltoupper="scrolltoupper"
>
@scroll="rightScroll" @scrolltoupper="scrolltoupper">
<view class="page-view u-p-l-24">
<view class="list-tight-top">
<template v-if="lingshi.show">
@@ -62,7 +60,7 @@
<view class="item-container">
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
<list-goods-item :limitTimeDiscount="data.limitTimeDiscount"
@chooseGuige="chooseGuige($event, index)"
:consStockList="consStockList" @chooseGuige="chooseGuige($event, index)"
@add="goodsUpdate($event, index, true)"
@reduce="goodsUpdate($event, index, false)" @tapweigh="tapweigh($event, index)"
:index="goodsIndex" :data="goodsItem"></list-goods-item>
@@ -81,7 +79,7 @@
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
<list-goods-item :img="{ width: '330rpx', height: '330rpx' }"
:limitTimeDiscount="data.limitTimeDiscount"
:consStockList="consStockList" :limitTimeDiscount="data.limitTimeDiscount"
@chooseGuige="chooseGuige(goodsItem.goodsIndex, goodsItem.index)"
@add="searchGoodsUpdate(goodsItem, goodsIndex, true)"
@reduce="searchGoodsUpdate(goodsItem, goodsIndex, false)"
@@ -98,8 +96,7 @@
<view class="bottom w-full">
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :table="data.table"
:data="cars" :orderInfo="data.orderInfo" :limitTimeDiscount="data.limitTimeDiscount"
@changeNumber="goodsChangeNumber"
@clear="cleaCart"></my-car>
@changeNumber="goodsChangeNumber" @clear="cleaCart"></my-car>
</view>
<!-- 套餐选择规格 -->
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
@@ -117,7 +114,8 @@
</view>
<!-- 修改购物车数量 -->
<popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data" @confirm="carsNumberChange"></popupChangeNumber>
<popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data"
@confirm="carsNumberChange"></popupChangeNumber>
</view>
</template>
<script setup>
@@ -196,6 +194,9 @@
cancelOrder,
rmPlaceOrder,
} from "@/http/api/order.js";
import {
getConsStock
} from '@/http/api/cons.js'
const modal = reactive({
key: "",
@@ -349,6 +350,24 @@
let $originGoods = [];
let $category = [];
const consStockList = ref([])
function getCons() {
return new Promise((resolve, reject) => {
try {
getConsStock({
shopId: uni.getStorageSync("shopInfo").id
}).then(res => {
consStockList.value = res || []
console.log('consStockList', consStockList.value);
resolve()
})
} catch (err) {
reject()
}
})
}
async function init() {
if (option.type == "add") {
setTabBar($category, $originGoods, []);
@@ -364,6 +383,8 @@
size: 300
});
$category = categoryRes.records;
// 获取耗材数据
await getCons()
// 获取商品数据
const goodsRes = await getGoods();
const goods = goodsRes.filter((v) => {
@@ -387,6 +408,8 @@
initCart();
}
const allHistoryOrder=ref([])
/**
* 获取订单详情
*/
@@ -409,13 +432,13 @@
console.log("data.historyOrder===", data.historyOrder);
let allHistoryOrder = data.historyOrder.map((item) => {
allHistoryOrder.value = data.historyOrder.map((item) => {
return [...item.info];
});
}).flat();
// console.log('allHistoryOrder===', allHistoryOrder.flat());
data.historyOrderNum = 0;
allHistoryOrder.flat().map((item) => {
allHistoryOrder.value.map((item) => {
data.historyOrderNum += item.num;
});
// console.log('data.historyOrderNum===', data.historyOrderNum);
@@ -741,7 +764,22 @@
}
// initCart()
}
// 封装成 Promise 的确认弹窗
const showConfirmModal = (title, content) => {
return new Promise((resolve) => {
uni.showModal({
title: title,
content: content,
showCancel: true,
cancelText: '取消添加',
confirmText: '继续',
success(res) {
// 确认返回 true取消/关闭返回 false
resolve(res.confirm === true);
}
});
});
};
/**
* 菜品操作
* @param {Object} foodsindex
@@ -800,6 +838,29 @@
//更新
let cartItem = cars[goodsInCarIndex];
let number = isAdd ? cartItem.number + 1 : +cartItem.number - 1;
if(isAdd){
if (number == 2 ) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'购物车已有该商品,请确认是否重复',
'菜名名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}
if(allHistoryOrder.value.find(v=>v.productId==$goods.id)){
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜名名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}
}
if (!isAdd) {
if (number === 0 || number < suitNum) {
//移除
@@ -828,6 +889,7 @@
data.isGoodsAdd = false;
setSearchGoods(searchGoodsIndex, number);
} else {
// 不影响之前的代码 称重suit单独处理
if ($goods.type == "weight" && showCurrentInput) {
suitNum = showCurrentInput;
@@ -839,6 +901,16 @@
return;
}
}
if(allHistoryOrder.value.find(v=>v.productId==$goods.id)){
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜名名称:《' + $goods.name + '》'
);
if (!isConfirm) {
return
}
}
// 套餐和单规格
if ($goods.groupType != 1) {
//增加
@@ -937,8 +1009,7 @@
tabbarItem.foods.find((v) => v.id == e.goods.product_id);
}
});
$sku = !e.goods.product_id ?
{
$sku = !e.goods.product_id ? {
suitNum: 1
} :
$goods.skuList.find((v) => v.id == e.goods.sku_id);
@@ -1018,13 +1089,22 @@
* @param {Object} skuList
*/
function returnSelGoodsSkuList(selectSpecInfo) {
// 👇 修复:如果是字符串,转成对象
if (typeof selectSpecInfo === 'string') {
selectSpecInfo = JSON.parse(selectSpecInfo);
}
let specInfo = [];
console.log('selectSpecInfo', selectSpecInfo);
for (var key in selectSpecInfo) {
console.log('key', key); // 现在会正确打印:口味、汤
specInfo.push({
name: key,
value: selectSpecInfo[key],
});
}
let result = specInfo.map((v, index) => {
return {
...v,
@@ -1062,9 +1142,31 @@
} = res;
let carGoods = cars[index];
let cartId = carGoods.id;
let newNumber = carGoods.number * 1 + suitNum;
let suitNum = goods.skuList[0].suitNum || 1;
let newNumber = carGoods.number * 1 + suitNum;
if (newNumber == 2&&carGoods.number<newNumber) {
// 等待用户点击
const isConfirm = await showConfirmModal(
'请确认当前菜品是否已上菜?',
'菜名名称' + goods.name + ''
);
if (!isConfirm) {
return
}
if(allHistoryOrder.value.find(v=>v.productId==goods.id)){
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜名名称:《' + goods.name + '》'
);
if (!isConfirm) {
return
}
}
}
editCart({
id: cartId,
number: newNumber,
@@ -1079,6 +1181,17 @@
);
data.isGoodsAdd = false;
} else {
if(allHistoryOrder.value.find(v=>v.productId==goods.id)){
// 等待用户点击
const isConfirm = await showConfirmModal(
'该商品已下单过,请确认是否重复',
'菜名名称:《' + goods.name + '》'
);
if (!isConfirm) {
return
}
}
//添加
editCart({
number: suitNum,
@@ -1106,8 +1219,7 @@
return carsGoods.sku_id == sku_id && carsGoods.product_id == product_id;
});
const carGoods = cars[goodsInCarIndex];
return carGoods ?
{
return carGoods ? {
index: goodsInCarIndex,
carGoods,
} :

View File

@@ -1,4 +1,5 @@
<template>
<view>
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
<template #desc>
<view class="u-p-30 u-text-left">
@@ -36,8 +37,8 @@
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
<up-tag @click="changeTagSel(item)" :text="item.label" plain borderColor="#E6FOFF"
color="#318AFE" v-if="item.checked"> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666" :text="item.label"
plain v-else> </up-tag>
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666"
:text="item.label" plain v-else> </up-tag>
</view>
</view>
<view class="u-m-t-24">
@@ -50,16 +51,37 @@
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10">
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel"
box-shadow>取消</my-button>
</view>
</view>
</template>
</my-model>
<up-modal :show="confirmModal.show" title="提示" @close="confirmModalClose" @cancel="confirmModalClose"
@confirm="confirmModalConfirm" showCancelButton>
<view>
<view>
<up-radio-group v-model="confirmModal.selRefundStock">
<up-radio v-for="(item,index) in confirmModal.refundStocks" :key="index" :label="item.name"
:name="item.key"></up-radio>
</up-radio-group>
</view>
</view>
</up-modal>
</view>
</template>
<script setup>
import { reactive, ref, watch } from 'vue';
import {
reactive,
ref,
watch
} from 'vue';
import infoBox from '@/commons/utils/infoBox.js'
const emits = defineEmits(['update:show', 'confirm'])
const props = defineProps({
@@ -76,6 +98,22 @@
default: false
}
})
const confirmModal = reactive({
show: false,
selRefundStock: false,
refundStocks: [{
name: '已上菜(仅退菜不退库存)',
key: false
}, {
name: '未上菜(退菜后退库存)',
key: true,
}]
})
function confirmModalClose() {
confirmModal.show = false
confirmModal.selRefundStock = false
}
const form = reactive({
note: ''
})
@@ -157,11 +195,51 @@
})
form.note = ''
}
import {
getProductDetail
} from '@/http/api/product.js'
import {
getCategoryDetail
} from '@/http/api/cateGory.js'
async function getGoodsCategory(goods) {
const res = await getProductDetail(goods.productId)
if (res) {
console.log('res', res);
const res1 = await getCategoryDetail(res.categoryId)
return res1
}
uni.showToast({
title: '获取该商品信息数据失败',
icon: 'none'
})
return null
}
function confirmModalConfirm() {
refundGoods()
confirmModalClose()
}
function refundGoods() {
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
let par = {
orderId: props.data.orderId,
refundAmount: number.value * props.data.unitPrice,
refundReason: note,
refundStock: confirmModal.selRefundStock,
refundDetails: [{
id: props.data.id,
returnAmount: number.value * props.data.unitPrice,
num: number.value,
}],
}
emits('confirm', par)
}
/**
* 确认退菜
*/
function confirm() {
async function confirm() {
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
console.log({
@@ -171,17 +249,22 @@
if (!note) {
return infoBox.showToast("请输入退菜原因");
}
let par = {
orderId: props.data.orderId,
refundAmount: number.value * props.data.unitPrice,
refundReason: note,
refundDetails: [{
id: props.data.id,
returnAmount: number.value * props.data.unitPrice,
num: number.value,
}],
const shopInfo = uni.getStorageSync('shopInfo')
if (shopInfo.refundMode == 1) {
const res = await getGoodsCategory(props.data)
if (res.refundMode === 3) {
confirmModal.show = true
return
}
emits('confirm', par)
}
if (shopInfo.refundMode == 2) {
const res = await getProductDetail(props.data.productId)
if (res.refundMode === 3) {
confirmModal.show = true
return
}
}
refundGoods()
}
</script>

View File

@@ -2,12 +2,15 @@
<view class="min-page bg-gray u-p-30">
<view class="bg-fff u-p-l-30 u-p-r-30 ">
<view class="myTabs u-m-t-20">
<my-tabs :list="pageData.tabsList" :modelValue="pageData.tabsIndex" :textKey="'label'" @change="tabsChange"></my-tabs>
<my-tabs :list="pageData.tabsList" :modelValue="pageData.tabsIndex" :textKey="'label'"
@change="tabsChange"></my-tabs>
</view>
</view>
<view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between" style="margin-top: 30rpx;">
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround" v-model="pageData.modify" >
<view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between"
style="margin-top: 30rpx;">
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround"
v-model="pageData.modify">
<template #prefix>
<up-text text="¥" margin="0 3px 0 0" type="tips"></up-text>
</template>
@@ -96,28 +99,60 @@
:color="$utils.ColorMain"></up-button>
</view>
<confirmRefundPopup ref="refundPopup" />
<up-modal :show="confirmModal.show" title="提示" @close="confirmModalClose" @cancel="confirmModalClose"
@confirm="confirmModalConfirm" showCancelButton>
<view>
<view>
<up-radio-group v-model="confirmModal.selRefundStock">
<up-radio v-for="(item,index) in confirmModal.refundStocks" :key="index" :label="item.name"
:name="item.key"></up-radio>
</up-radio-group>
</view>
</view>
</up-modal>
</view>
</template>
<script setup>
import { computed, reactive, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
import {
onLoad,
onShow
} from '@dcloudio/uni-app';
import confirmRefundPopup from './components/confirmRefundPopup.vue';
import {hasPermission} from '@/commons/utils/hasPermission.js'
import { refundOrder } from '@/http/api/order.js'
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
import {
refundOrder
} from '@/http/api/order.js'
import {
mathFloorPrice
} from '@/commons/utils/goodsUtil.js'
let note = ref('')
const tuikuan = reactive({
list: ['点错', '数量点错', '客人要求', '协商退费'],
sel: -1
})
const pageData = reactive({
tabsList: [
{label: '部分退款', value: 0},
{label: '全部退款', value: 1},
{label: '自定义退款', value: 2},
tabsList: [{
label: '部分退款',
value: 0
},
{
label: '全部退款',
value: 1
},
{
label: '自定义退款',
value: 2
},
],
tabsIndex: 0,
modify: '',
@@ -168,6 +203,7 @@
function changeTuiKuanSel(i) {
tuikuan.sel = i
}
function parseIntNumber(e) {
if (e > (orderDetail.info.payAmount - orderDetail.info.refundAmount)) {
setTimeout(() => {
@@ -272,6 +308,7 @@
params = {
orderId: option.orderId,
refundReason: noteResult,
refundStock: confirmModal.selRefundStock,
refundDetails: orderDetail.goodsList.filter(v => v.number * 1).map(v => {
return {
id: v.id,
@@ -297,17 +334,77 @@
refundPost()
}
async function refundPost (payPassword) {
import {
getProductList,
getCategoryList
} from '@/http/api/product.js'
const confirmModal = reactive({
show: false,
selRefundStock: false,
payPassword: '',
refundStocks: [{
name: '已上菜(仅退菜不退库存)',
key: false
}, {
name: '未上菜(退菜后退库存)',
key: true,
}]
})
function confirmModalClose() {
confirmModal.show = false
confirmModal.selRefundStock = false
confirmModal.payPassword = ''
}
function confirmModalConfirm() {
refundSubmit(confirmModal.payPassword)
confirmModalClose()
}
async function refundSubmit(payPassword) {
if (payPassword) {
params.pwd = payPassword
}
params.refundStock = confirmModal.selRefundStock
await refundOrder(params)
uni.$utils.showToast('退款请求提交成功')
setTimeout(() => {
uni.navigateBack({delta:1})
uni.navigateBack({
delta: 1
})
}, 500)
}
async function refundPost(payPassword) {
confirmModal.payPassword = confirmModal.payPassword
const shopInfo = uni.getStorageSync('shopInfo')
if (pageData.tabsIndex != 2) {
if (shopInfo.refundMode == 1) {
const res = await getCategoryList()
for (let goods of res) {
if (goods.refundMode == 3) {
confirmModal.show = true
return
}
}
}
if (shopInfo.refundMode == 2) {
const res = await getProductList()
for (let goods of res) {
console.log(goods);
if (goods.refundMode == 3) {
confirmModal.show = true
return
}
}
}
}
refundSubmit(payPassword)
}
</script>
<style lang="scss" scoped>