Compare commits
7 Commits
4aea9740a1
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| dbe74f6486 | |||
| 2db9f6811a | |||
| bc7b6d41f5 | |||
| e51e2f4298 | |||
| 5032b86d69 | |||
| ecb9de0d9b | |||
| 4cde9d6b7b |
@@ -8,9 +8,9 @@
|
|||||||
:height="height"
|
:height="height"
|
||||||
:maxCount="maxCount"
|
:maxCount="maxCount"
|
||||||
>
|
>
|
||||||
<template #default v-if="$slots.default">
|
<!-- <template #default v-if="$slots.default">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</template>
|
</template> -->
|
||||||
</up-upload>
|
</up-upload>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类添加
|
* 分类添加
|
||||||
|
|||||||
@@ -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
|
* @returns
|
||||||
|
|||||||
@@ -13,15 +13,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<uni-forms-item label="分类名称" required name="name">
|
<uni-forms-item label="分类名称" required name="name">
|
||||||
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'"
|
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
|
||||||
:inputBorder="false" v-model="category.name" placeholder="输入分类名称" />
|
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>
|
</uni-forms-item>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="option.type==='edit'">
|
<template v-if="option.type==='edit'">
|
||||||
<uni-forms-item label="排序" required name="sort">
|
<uni-forms-item label="排序" required name="sort">
|
||||||
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'"
|
<uni-easyinput padding-none :placeholderStyle="'font-size:28rpx;'" :inputBorder="false"
|
||||||
:inputBorder="false" v-model="category.sort" type="number"
|
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
|
||||||
placeholder="排序越小越靠前" />
|
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</template>
|
</template>
|
||||||
<uni-forms-item label="">
|
<uni-forms-item label="">
|
||||||
@@ -50,14 +57,35 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import {
|
||||||
|
reactive,
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import infoBox from '@/commons/utils/infoBox.js';
|
import infoBox from '@/commons/utils/infoBox.js';
|
||||||
import mySwitch from '@/components/my-components/my-switch'
|
import mySwitch from '@/components/my-components/my-switch'
|
||||||
import myUploadFile from '@/components/my-components/my-upload-file'
|
import myUploadFile from '@/components/my-components/my-upload-file'
|
||||||
import { onLoad, onReady } from '@dcloudio/uni-app';
|
import {
|
||||||
import { addCategory, putCategory } from '@/http/api/cateGory.js'
|
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({
|
const category = reactive({
|
||||||
@@ -121,6 +149,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateFunc(key, value) {
|
function validateFunc(key, value) {
|
||||||
if (validateFuncObj.hasOwnProperty(key)) {
|
if (validateFuncObj.hasOwnProperty(key)) {
|
||||||
const func = validateFuncObj[key]
|
const func = validateFuncObj[key]
|
||||||
|
|||||||
@@ -18,6 +18,12 @@
|
|||||||
<view>预警值</view>
|
<view>预警值</view>
|
||||||
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
||||||
</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 v-if="!datas.form.id" style="justify-content: space-between">
|
||||||
<view>耗材类型</view>
|
<view>耗材类型</view>
|
||||||
<view style="width: 54%" @tap="datas.show = !datas.show">
|
<view style="width: 54%" @tap="datas.show = !datas.show">
|
||||||
@@ -55,7 +61,8 @@
|
|||||||
<view class="label">默认入库单位</view>
|
<view class="label">默认入库单位</view>
|
||||||
<view class="ipt">
|
<view class="ipt">
|
||||||
<u-radio-group v-model="datas.form.defaultUnit">
|
<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>
|
</u-radio-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -63,226 +70,252 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<view class="bottombutton">
|
<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>
|
</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>
|
<up-toast ref="uToastRef"></up-toast>
|
||||||
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue';
|
import {
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
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({
|
let datas = reactive({
|
||||||
show: false,
|
show: false,
|
||||||
form: {
|
form: {
|
||||||
conUnit: '',
|
conUnit: '',
|
||||||
conName: '',
|
conName: '',
|
||||||
price: '',
|
price: '',
|
||||||
conWarning: 999,
|
conWarning: 999,
|
||||||
consGroupId: null,
|
consGroupId: null,
|
||||||
conUnitTwo: '', // 第二单位
|
conUnitTwo: '', // 第二单位
|
||||||
conUnitTwoConvert: '', // 第二单位转换数量
|
conUnitTwoConvert: '', // 第二单位转换数量
|
||||||
defaultUnit: ''
|
defaultUnit: '',
|
||||||
},
|
isStock: 1,
|
||||||
consGroupName: '',
|
},
|
||||||
typeList: []
|
consGroupName: '',
|
||||||
});
|
typeList: []
|
||||||
|
|
||||||
onLoad((options) => {
|
|
||||||
if (options && options.item) {
|
|
||||||
let obj = JSON.parse(decodeURIComponent(options.item));
|
|
||||||
datas.form = obj;
|
|
||||||
|
|
||||||
unitList.value = [];
|
|
||||||
if (datas.form.conUnit !== '') {
|
|
||||||
unitList.value.push(datas.form.conUnit);
|
|
||||||
}
|
|
||||||
if (datas.form.conUnitTwo !== '') {
|
|
||||||
unitList.value.push(datas.form.conUnitTwo);
|
|
||||||
}
|
|
||||||
console.log('datas.form', datas.form);
|
|
||||||
console.log('unitList.value', unitList.value);
|
|
||||||
} else {
|
|
||||||
gettbConsTypeList();
|
|
||||||
}
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
onLoad((options) => {
|
||||||
* 获取耗材类别
|
if (options && options.item) {
|
||||||
*/
|
let obj = JSON.parse(decodeURIComponent(options.item));
|
||||||
let gettbConsTypeList = () => {
|
datas.form = obj;
|
||||||
getConsGrpupList({
|
|
||||||
page: 1,
|
unitList.value = [];
|
||||||
size: 30
|
if (datas.form.conUnit !== '') {
|
||||||
}).then((res) => {
|
unitList.value.push(datas.form.conUnit);
|
||||||
datas.typeList = [res];
|
}
|
||||||
|
if (datas.form.conUnitTwo !== '') {
|
||||||
|
unitList.value.push(datas.form.conUnitTwo);
|
||||||
|
}
|
||||||
|
console.log('datas.form', datas.form);
|
||||||
|
console.log('unitList.value', unitList.value);
|
||||||
|
} else {
|
||||||
|
gettbConsTypeList();
|
||||||
|
}
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
function confirmConsGroup(e) {
|
/**
|
||||||
datas.show = false;
|
* 获取耗材类别
|
||||||
datas.form.consGroupId = e.value[0].id;
|
*/
|
||||||
datas.consGroupName = e.value[0].name;
|
let gettbConsTypeList = () => {
|
||||||
}
|
getConsGrpupList({
|
||||||
|
page: 1,
|
||||||
|
size: 30
|
||||||
|
}).then((res) => {
|
||||||
|
datas.typeList = [res];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
let sumbit = async () => {
|
function confirmConsGroup(e) {
|
||||||
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, '');
|
datas.show = false;
|
||||||
if (!conUnitdata) {
|
datas.form.consGroupId = e.value[0].id;
|
||||||
uni.$utils.showToast('单位不能为空');
|
datas.consGroupName = e.value[0].name;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (!datas.form.price) {
|
|
||||||
uni.$utils.showToast('价格不能为空');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!datas.form.consGroupId) {
|
|
||||||
uni.$utils.showToast('耗材类型不能为空');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!datas.form.id) {
|
|
||||||
await addCons({ ...datas.form });
|
|
||||||
} else {
|
|
||||||
await editCons({ ...datas.form });
|
|
||||||
}
|
|
||||||
uni.navigateBack();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示选择单位
|
let sumbit = async () => {
|
||||||
const unitShow = ref(false);
|
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, '');
|
||||||
// 单位列表
|
if (!conUnitdata) {
|
||||||
const unitList = ref([]);
|
uni.$utils.showToast('单位不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.price) {
|
||||||
|
uni.$utils.showToast('价格不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.consGroupId) {
|
||||||
|
uni.$utils.showToast('耗材类型不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.id) {
|
||||||
|
await addCons({
|
||||||
|
...datas.form
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await editCons({
|
||||||
|
...datas.form
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示选择单位
|
||||||
|
const unitShow = ref(false);
|
||||||
|
// 单位列表
|
||||||
|
const unitList = ref([]);
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.topTitle {
|
.topTitle {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin: 32rpx 28rpx;
|
margin: 32rpx 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addConsumables {
|
.addConsumables {
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
margin: 32rpx;
|
margin: 32rpx;
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
> view {
|
>view {
|
||||||
> view {
|
>view {
|
||||||
width: 646rpx;
|
width: 646rpx;
|
||||||
height: 84rpx;
|
|
||||||
background: #fcfcfc;
|
|
||||||
border: 2rpx solid #f9f9f9;
|
|
||||||
margin-top: 32rpx;
|
|
||||||
.df;
|
|
||||||
|
|
||||||
> view:first-child {
|
|
||||||
width: 190rpx;
|
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
line-height: 84rpx;
|
background: #fcfcfc;
|
||||||
// text-align: left;
|
|
||||||
padding-left: 24rpx;
|
|
||||||
background: #f9f9f9;
|
|
||||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
|
||||||
border: 2rpx solid #f9f9f9;
|
border: 2rpx solid #f9f9f9;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
margin-top: 32rpx;
|
||||||
font-weight: 400;
|
.df;
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
>view:first-child {
|
||||||
|
width: 240rpx;
|
||||||
|
height: 84rpx;
|
||||||
|
line-height: 84rpx;
|
||||||
|
// text-align: left;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||||
|
border: 2rpx solid #f9f9f9;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.bottombutton {
|
.bottombutton {
|
||||||
margin-top: 84rpx;
|
margin-top: 84rpx;
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
|
|
||||||
> button {
|
>button {
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
|
||||||
margin: 0 32rpx;
|
|
||||||
position: absolute;
|
|
||||||
// top: 100%;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 10;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.df() {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.tips-wrap {
|
|
||||||
--pColor: #e6a23c;
|
|
||||||
--iColor: #fdf6ec;
|
|
||||||
padding: 0 28upx;
|
|
||||||
.content {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 28upx;
|
|
||||||
background-color: var(--iColor);
|
|
||||||
|
|
||||||
.info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding-left: 10px;
|
|
||||||
gap: 8upx;
|
|
||||||
.t1 {
|
|
||||||
font-size: 32upx;
|
|
||||||
color: var(--pColor);
|
|
||||||
}
|
|
||||||
.t2 {
|
|
||||||
font-size: 24upx;
|
|
||||||
color: var(--pColor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.form-wrap {
|
.status {
|
||||||
padding: 28upx 28upx 0;
|
margin: 0 32rpx;
|
||||||
.form {
|
position: absolute;
|
||||||
padding: 28upx;
|
// top: 100%;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 16upx;
|
|
||||||
}
|
}
|
||||||
.row {
|
|
||||||
height: 84upx;
|
.df() {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20upx;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #fcfcfc;
|
}
|
||||||
padding: 0 20upx;
|
|
||||||
&:not(:last-child) {
|
.tips-wrap {
|
||||||
margin-bottom: 28upx;
|
--pColor: #e6a23c;
|
||||||
}
|
--iColor: #fdf6ec;
|
||||||
.label {
|
padding: 0 28upx;
|
||||||
font-size: 32upx;
|
|
||||||
color: #333;
|
.content {
|
||||||
}
|
display: flex;
|
||||||
.ipt {
|
align-items: center;
|
||||||
flex: 1;
|
padding: 28upx;
|
||||||
|
background-color: var(--iColor);
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
gap: 8upx;
|
||||||
|
|
||||||
|
.t1 {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.t2 {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-wrap {
|
||||||
|
padding: 28upx 28upx 0;
|
||||||
|
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
height: 84upx;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fcfcfc;
|
||||||
|
padding: 0 20upx;
|
||||||
|
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -11,26 +11,26 @@
|
|||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> <text style="color: red;">*</text> 入库时间 </view>
|
<view> <text style="color: red;">*</text> 入库时间 </view>
|
||||||
<view >
|
<view>
|
||||||
<up-datetime-picker
|
<up-datetime-picker hasInput v-model="datas.form.inOutDate" mode="date"></up-datetime-picker>
|
||||||
hasInput
|
|
||||||
v-model="datas.form.inOutDate"
|
|
||||||
mode="date"
|
|
||||||
|
|
||||||
></up-datetime-picker>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> <text style="color: red;">*</text> 入库数量 </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>
|
<view>
|
||||||
<view> <text style="color: red;">*</text>单价 </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>
|
||||||
<view style="justify-content: space-between;">
|
<view style="justify-content: space-between;">
|
||||||
<view> 单位 </view>
|
<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>
|
||||||
<view> 应付金额 </view>
|
<view> 应付金额 </view>
|
||||||
@@ -43,7 +43,8 @@
|
|||||||
<view style="justify-content: space-between;align-items: center;">
|
<view style="justify-content: space-between;align-items: center;">
|
||||||
<view> 供应商 </view>
|
<view> 供应商 </view>
|
||||||
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
|
<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>
|
</picker>
|
||||||
<uni-icons type="bottom" size="16"></uni-icons>
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
|
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
|
||||||
@@ -64,13 +65,24 @@
|
|||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, reactive } from 'vue';
|
import {
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
ref,
|
||||||
|
computed,
|
||||||
|
reactive
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
onShow,
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { getVendorPage } from '@/http/api/vendor.js';
|
import {
|
||||||
import { consStockIn } from '@/http/api/cons.js';
|
getVendorPage
|
||||||
|
} from '@/http/api/vendor.js';
|
||||||
|
import {
|
||||||
|
consStockIn
|
||||||
|
} from '@/http/api/cons.js';
|
||||||
|
|
||||||
let showStatus = ref(false)
|
let showStatus = ref(false)
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
@@ -95,7 +107,7 @@
|
|||||||
datas.item = JSON.parse(options.item)
|
datas.item = JSON.parse(options.item)
|
||||||
datas.form = Object.assign(datas.form, datas.item)
|
datas.form = Object.assign(datas.form, datas.item)
|
||||||
// 单位列表
|
// 单位列表
|
||||||
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
datas.unitList = [datas.form.conUnit, datas.form.conUnitTwo]
|
||||||
datas.form.bodyList.unit = datas.form.defaultUnit
|
datas.form.bodyList.unit = datas.form.defaultUnit
|
||||||
datas.form.bodyList.conName = datas.form.conName
|
datas.form.bodyList.conName = datas.form.conName
|
||||||
datas.form.bodyList.unitName = datas.form.unitName
|
datas.form.bodyList.unitName = datas.form.unitName
|
||||||
@@ -157,10 +169,11 @@
|
|||||||
datas.form.bodyList.conId = datas.item.id
|
datas.form.bodyList.conId = datas.item.id
|
||||||
datas.form.bodyList = [datas.form.bodyList]
|
datas.form.bodyList = [datas.form.bodyList]
|
||||||
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
|
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
|
||||||
|
|
||||||
consStockIn({
|
consStockIn({
|
||||||
...datas.form,
|
...datas.form,
|
||||||
// 供应商id
|
// 供应商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,
|
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
uni.$utils.showToast("保存成功")
|
uni.$utils.showToast("保存成功")
|
||||||
@@ -168,7 +181,7 @@
|
|||||||
go.back()
|
go.back()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
},1000)
|
}, 1000)
|
||||||
// 获取供应商
|
// 获取供应商
|
||||||
const statusHeight = computed(() => {
|
const statusHeight = computed(() => {
|
||||||
return 30 * datas.status.length + 14 + 'px'
|
return 30 * datas.status.length + 14 + 'px'
|
||||||
@@ -194,9 +207,11 @@
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
::v-deep.u-input{
|
|
||||||
border: none!important;
|
::v-deep.u-input {
|
||||||
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
margin: 0 32rpx;
|
margin: 0 32rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ async function getProductListAjax() {
|
|||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
const res = await getProductList();
|
const res = await getProductList();
|
||||||
|
console.log('res',res);
|
||||||
list.value = res;
|
list.value = res;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -145,7 +145,7 @@
|
|||||||
let obj = pageData.types.find(item=> item.value == e)
|
let obj = pageData.types.find(item=> item.value == e)
|
||||||
return obj.name
|
return obj.name
|
||||||
}
|
}
|
||||||
|
let selArr=[]
|
||||||
getGoods()
|
getGoods()
|
||||||
/**
|
/**
|
||||||
* 获取商品列表
|
* 获取商品列表
|
||||||
@@ -200,7 +200,6 @@
|
|||||||
|
|
||||||
const show = ref(props.modelValue)
|
const show = ref(props.modelValue)
|
||||||
|
|
||||||
let selArr=[]
|
|
||||||
|
|
||||||
let $selGoodsMap={}
|
let $selGoodsMap={}
|
||||||
async function open(arr) {
|
async function open(arr) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="default-box-padding bg-fff border-r-18">
|
<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 class="u-flex u-row-between">
|
||||||
<view>商品名称</view>
|
<view>商品名称</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -58,12 +59,29 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="default-box-padding bg-fff border-r-18 u-flex u-row-between u-m-t-32">
|
<view class="default-box-padding bg-fff border-r-18 u-m-t-32">
|
||||||
<view>当某个耗材的使用库存不足时,商品自动售罄。</view>
|
<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">当前店铺退菜退库存规则:{{nowRefundRule}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<my-button type="primary" shape="circle" font-weight="700" @click="save">保存</my-button>
|
<my-button type="primary" shape="circle" font-weight="700" @click="save">保存</my-button>
|
||||||
<my-button bgColor="#F9F9F9" shape="circle" color="#999" @click="cancel">取消</my-button>
|
<my-button bgColor="#F9F9F9" shape="circle" color="#999" @click="cancel">取消</my-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -72,15 +90,42 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 infoBox from '@/commons/utils/infoBox.js'
|
||||||
import chooseHaocai from './choose-haocai.vue';
|
import chooseHaocai from './choose-haocai.vue';
|
||||||
import chooseDanwei from './choose-danwei.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 {
|
||||||
import { productBindCons } from '@/http/api/product.js';
|
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'])
|
const emits = defineEmits(['cancel', 'updateGoods'])
|
||||||
|
|
||||||
@@ -91,20 +136,29 @@
|
|||||||
return {
|
return {
|
||||||
consList: [],
|
consList: [],
|
||||||
skuList: [],
|
skuList: [],
|
||||||
type: ''
|
type: '',
|
||||||
|
isAutoSoldStock:0,
|
||||||
|
isRefundStock:1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const shopInfo=uni.getStorageSync('shopInfo')
|
||||||
|
const nowRefundRule=computed(()=>{
|
||||||
|
if(!shopInfo||!shopInfo.refundMode){
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return shopInfo.refundMode==1?'跟随商品分类':'跟随单商品'
|
||||||
|
})
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
isBindGuige: false, //是否绑定至规格
|
isBindGuige: false, //是否绑定至规格
|
||||||
})
|
})
|
||||||
|
|
||||||
let haoCaiList = ref([])
|
let haoCaiList = ref([])
|
||||||
let $haocaiMap = reactive({})
|
let $haocaiMap = reactive({})
|
||||||
const skuList = ref(props.goods.skuList)
|
const skuList = ref(props.goods.skuList)
|
||||||
const consList = ref(props.goods.consList||[])
|
const consList = ref(props.goods.consList || [])
|
||||||
|
|
||||||
watch(() => props.goods.consList, (newval) => {
|
watch(() => props.goods.consList, (newval) => {
|
||||||
consList.value = newval
|
consList.value = newval
|
||||||
})
|
})
|
||||||
@@ -207,7 +261,6 @@
|
|||||||
emits('updateGoods')
|
emits('updateGoods')
|
||||||
infoBox.showToast('修改成功')
|
infoBox.showToast('修改成功')
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
11
pageProduct/add-Product/components/link-goods.vue
Normal file
11
pageProduct/add-Product/components/link-goods.vue
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view>上传图片</view>
|
<view>上传图片</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-16">
|
<view class="u-m-t-16" >
|
||||||
<my-up-upload :maxCount="1" :multiple="false" v-model="form.coverImg"></my-up-upload>
|
<my-up-upload :maxCount="1" :multiple="false" v-model="form.coverImg"></my-up-upload>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
<text class="">排序</text>
|
<text class="">排序</text>
|
||||||
<text class="u-m-l-20">{{data.sort}}</text>
|
<text class="u-m-l-20">{{data.sort}}</text>
|
||||||
</view>
|
</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>
|
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
|
||||||
<up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon>
|
<up-icon @click="editStock" name="edit-pen" :size="16" :color="$utils.ColorMain"></up-icon>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->
|
<!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->
|
||||||
|
|||||||
@@ -5,25 +5,19 @@
|
|||||||
<view class="input-wrapper">
|
<view class="input-wrapper">
|
||||||
<view class="input-main">
|
<view class="input-main">
|
||||||
<view class="u-flex u-p-r-30 u-font-28" @click="pageData.statusShow = !pageData.statusShow">
|
<view class="u-flex u-p-r-30 u-font-28" @click="pageData.statusShow = !pageData.statusShow">
|
||||||
<text class="u-m-r-10 u-line-1" :class="{ 'color-main': pageData.query.status != '' }" style="max-width: 100rpx">{{ pageData.statusName }}</text>
|
<text class="u-m-r-10 u-line-1" :class="{ 'color-main': pageData.query.status != '' }"
|
||||||
|
style="max-width: 100rpx">{{ pageData.statusName }}</text>
|
||||||
<up-icon name="arrow-down" size="16"></up-icon>
|
<up-icon name="arrow-down" size="16"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<uni-easyinput
|
<uni-easyinput clearable class="jeepay-search" :inputBorder="false" trim="all" placeholder="搜索"
|
||||||
clearable
|
v-model="pageData.query.name" @clear="searchConfirm" @confirm="searchConfirm">
|
||||||
class="jeepay-search"
|
|
||||||
:inputBorder="false"
|
|
||||||
trim="all"
|
|
||||||
placeholder="搜索"
|
|
||||||
v-model="pageData.query.name"
|
|
||||||
@clear="searchConfirm"
|
|
||||||
@confirm="searchConfirm"
|
|
||||||
>
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
<view class="u-m-l-4">
|
<view class="u-m-l-4">
|
||||||
<button class="" type="text" @click="searchConfirm"><text class="color-333">搜索</text></button>
|
<button class="" type="text" @click="searchConfirm"><text
|
||||||
|
class="color-333">搜索</text></button>
|
||||||
<!-- <button class="" type="text" ><text class="color-main font-bold">清台设置</text></button> -->
|
<!-- <button class="" type="text" ><text class="color-main font-bold">清台设置</text></button> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -39,7 +33,8 @@
|
|||||||
<!-- <view class="u-m-t-10">0/12</view> -->
|
<!-- <view class="u-m-t-10">0/12</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item u-p-20" :class="{ sel: pageData.area.sel === item.id }" @tap="changeAreaSel(item)" v-for="(item, index) in pageData.area.list" :key="index">
|
<view class="item u-p-20" :class="{ sel: pageData.area.sel === item.id }" @tap="changeAreaSel(item)"
|
||||||
|
v-for="(item, index) in pageData.area.list" :key="index">
|
||||||
<view class="box">
|
<view class="box">
|
||||||
<view class="up-line-1">{{ item.name }}</view>
|
<view class="up-line-1">{{ item.name }}</view>
|
||||||
<!-- <view class="u-m-t-10">0/12</view> -->
|
<!-- <view class="u-m-t-10">0/12</view> -->
|
||||||
@@ -51,410 +46,451 @@
|
|||||||
<template v-if="pageData.tabList.length">
|
<template v-if="pageData.tabList.length">
|
||||||
<view class="u-flex u-flex-wrap u-row-between">
|
<view class="u-flex u-flex-wrap u-row-between">
|
||||||
<view class="u-m-b-30" v-for="(item, index) in pageData.tabList" :key="index">
|
<view class="u-m-b-30" v-for="(item, index) in pageData.tabList" :key="index">
|
||||||
<table-item @bind="scanCode" @update="getTable" :areaMap="pageData.areaMap" @more="moreShow(item)" :data="item"></table-item>
|
<table-item @bind="scanCode" @update="getTable" :areaMap="pageData.areaMap"
|
||||||
|
@more="moreShow(item)" :data="item"></table-item>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size" @change="pageChange"></my-pagination>
|
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements"
|
||||||
|
:size="pageData.query.size" @change="pageChange"></my-pagination>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<my-img-empty v-if="pageData.hasAjax && !pageData.tabList.length" tips="未找到相关桌台"></my-img-empty>
|
<my-img-empty v-if="pageData.hasAjax && !pageData.tabList.length" tips="未找到相关桌台"></my-img-empty>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<my-action-sheet :active="4" @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list" :title="actionSheet.title">
|
<my-action-sheet :active="4" @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"
|
||||||
|
:title="actionSheet.title">
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="color-999 u-p-30 u-text-center border-bottom">桌号:{{ actionSheet.title }}</view>
|
<view class="color-999 u-p-30 u-text-center border-bottom">桌号:{{ actionSheet.title }}</view>
|
||||||
</template>
|
</template>
|
||||||
</my-action-sheet>
|
</my-action-sheet>
|
||||||
<up-picker :show="pageData.statusShow" :columns="pageData.statusList" keyName="label" @cancel="pageData.statusShow = false" @confirm="confirmStatus"></up-picker>
|
<up-picker :show="pageData.statusShow" :columns="pageData.statusList" keyName="label"
|
||||||
|
@cancel="pageData.statusShow = false" @confirm="confirmStatus"></up-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
|
import {
|
||||||
import { ref, reactive, computed, watch } from 'vue';
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
computed,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import tableItem from './components/table-item';
|
import tableItem from './components/table-item';
|
||||||
|
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import myActionSheet from '@/components/my-components/my-action-sheet';
|
import myActionSheet from '@/components/my-components/my-action-sheet';
|
||||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js';
|
||||||
|
|
||||||
import { getShopTable, shopTableBind, shopTableClear } from '@/http/api/table.js';
|
import {
|
||||||
import { getShopArea } from '@/http/api/area.js';
|
getShopTable,
|
||||||
import { printOrder } from '@/http/api/order.js';
|
shopTableBind,
|
||||||
import { getHistoryOrder } from '@/http/api/order.js';
|
shopTableClear
|
||||||
|
} from '@/http/api/table.js';
|
||||||
|
import {
|
||||||
|
getShopArea
|
||||||
|
} from '@/http/api/area.js';
|
||||||
|
import {
|
||||||
|
printOrder
|
||||||
|
} from '@/http/api/order.js';
|
||||||
|
import {
|
||||||
|
getHistoryOrder
|
||||||
|
} from '@/http/api/order.js';
|
||||||
import tableStatus from './tableStatus'
|
import tableStatus from './tableStatus'
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
statusShow: false,
|
statusShow: false,
|
||||||
hasAjax: false,
|
hasAjax: false,
|
||||||
areaMap: {},
|
areaMap: {},
|
||||||
query: {
|
query: {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
status: '',
|
status: '',
|
||||||
areaId: '',
|
areaId: '',
|
||||||
name: ''
|
name: ''
|
||||||
},
|
},
|
||||||
totalElements: 0,
|
totalElements: 0,
|
||||||
statusList: [
|
statusList: [
|
||||||
[
|
[{
|
||||||
{
|
key: '',
|
||||||
key: '',
|
label: '全部'
|
||||||
label: '全部'
|
},
|
||||||
},
|
// ...uni.$utils.objToArrary(uni.$dict.tableStatus)
|
||||||
// ...uni.$utils.objToArrary(uni.$dict.tableStatus)
|
|
||||||
...tableStatus
|
...tableStatus
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
statusName: '全部',
|
statusName: '全部',
|
||||||
tabList: [],
|
tabList: [],
|
||||||
area: {
|
area: {
|
||||||
list: [],
|
list: [],
|
||||||
sel: ''
|
sel: ''
|
||||||
},
|
},
|
||||||
orderInfo: null
|
orderInfo: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const refMoreSheet = ref(null);
|
const refMoreSheet = ref(null);
|
||||||
const actionSheet = reactive({
|
const actionSheet = reactive({
|
||||||
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单', '绑定码牌'],
|
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单', '绑定码牌'],
|
||||||
title: '',
|
title: '',
|
||||||
selTable: ''
|
selTable: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => pageData.area.sel,
|
() => pageData.area.sel,
|
||||||
(newval) => {
|
(newval) => {
|
||||||
|
pageData.query.page = 1;
|
||||||
|
getTable();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
onShow((opt) => {
|
||||||
|
getData();
|
||||||
|
});
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
getTable();
|
||||||
|
getArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取桌台列表
|
||||||
|
*/
|
||||||
|
async function getTable() {
|
||||||
|
const res = await getShopTable(pageData.query);
|
||||||
|
pageData.hasAjax = true;
|
||||||
|
pageData.tabList = res.records;
|
||||||
|
pageData.totalElements = res.totalRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取区域
|
||||||
|
*/
|
||||||
|
async function getArea() {
|
||||||
|
const res = await getShopArea({
|
||||||
|
name: '',
|
||||||
|
page: 1,
|
||||||
|
size: 300
|
||||||
|
});
|
||||||
|
pageData.area.list = res.records;
|
||||||
|
pageData.areaMap = res.records.reduce((prve, cur) => {
|
||||||
|
prve[cur.id] = cur.name;
|
||||||
|
return prve;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型选择
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
function confirmStatus(e) {
|
||||||
|
console.log('---',e);
|
||||||
|
pageData.statusShow = false;
|
||||||
|
pageData.query.status = e.value[0].type;
|
||||||
|
pageData.statusName = e.value[0].label;
|
||||||
|
getTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域选择确定
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
function changeAreaSel(item) {
|
||||||
|
pageData.area.sel = item.id;
|
||||||
|
pageData.query.areaId = item.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更多操作打开
|
||||||
|
* @param {Object} table
|
||||||
|
*/
|
||||||
|
function moreShow(table) {
|
||||||
|
actionSheet.title = table.name;
|
||||||
|
actionSheet.selTable = table;
|
||||||
|
refMoreSheet.value.open();
|
||||||
|
if (actionSheet.selTable.orderId) {
|
||||||
|
getHistoryOrder({
|
||||||
|
orderId: actionSheet.selTable.orderId
|
||||||
|
}).then((res) => {
|
||||||
|
pageData.orderInfo = res;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更多操作选择
|
||||||
|
* @param {Object} index
|
||||||
|
*/
|
||||||
|
async function actionSheetClick(index) {
|
||||||
|
console.log(index);
|
||||||
|
const item = actionSheet.selTable;
|
||||||
|
if (index == 0) {
|
||||||
|
if (!item.orderId) {
|
||||||
|
return uni.$utils.showToast('该桌台暂无要结账的订单!');
|
||||||
|
}
|
||||||
|
const canJieZhang = await hasPermission('允许收款');
|
||||||
|
if (!canJieZhang) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return toPay(item);
|
||||||
|
}
|
||||||
|
if (index == 1) {
|
||||||
|
//清台
|
||||||
|
return uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要清台:' + item.name + '?',
|
||||||
|
success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
shopTableClear({
|
||||||
|
id: item.id
|
||||||
|
}).then((res) => {
|
||||||
|
uni.$utils.showToast('清台成功');
|
||||||
|
pageData.query.page = 1;
|
||||||
|
getTable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (index == 2) {
|
||||||
|
if (item.status == 'idle' || item.status == 'unsettled') {
|
||||||
|
return go.to('PAGES_CREATE_ORDER', item);
|
||||||
|
}else{
|
||||||
|
return uni.$utils.showToast('当前台桌不可增减菜!');
|
||||||
|
}
|
||||||
|
// return uni.$utils.showToast('待开放,请敬请期待!');
|
||||||
|
}
|
||||||
|
if (index == 3) {
|
||||||
|
return uni.$utils.showToast('待开放,请敬请期待!');
|
||||||
|
}
|
||||||
|
if (index == 4) {
|
||||||
|
//打印订单
|
||||||
|
if (!item.orderId) {
|
||||||
|
return uni.$utils.showToast('该桌台暂无要打印的订单!');
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = await printOrder({
|
||||||
|
id: actionSheet.selTable.orderId,
|
||||||
|
type: pageData.orderInfo.status == 'unpaid' ? 1 : 0
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index == 6) {
|
||||||
|
//绑定码牌
|
||||||
|
scanCode(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.$utils.showToast('待开放,请敬请期待!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去结账
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
function toPay(item) {
|
||||||
|
go.to('PAGES_ORDER_PAY', {
|
||||||
|
tableId: item.id,
|
||||||
|
tableName: item.name,
|
||||||
|
orderId: item.orderId,
|
||||||
|
discount: 1,
|
||||||
|
userId: item.userId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定码牌
|
||||||
|
* @param {Object} item
|
||||||
|
*/
|
||||||
|
function scanCode(item) {
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
success: function(res) {
|
||||||
|
console.log('条码类型:' + res.scanType);
|
||||||
|
console.log('条码内容:' + res.result);
|
||||||
|
let params = getQueryString(res.result);
|
||||||
|
shopTableBind({
|
||||||
|
tableCode: params.code,
|
||||||
|
id: item.id
|
||||||
|
}).then((res) => {
|
||||||
|
uni.$utils.showToast('桌台绑定成功');
|
||||||
|
setTimeout(() => {
|
||||||
|
getTable();
|
||||||
|
}, 1500);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解码
|
||||||
|
* @param {Object} url
|
||||||
|
*/
|
||||||
|
function getQueryString(url) {
|
||||||
|
let params = {};
|
||||||
|
// 正则表达式来匹配URL中的查询字符串
|
||||||
|
let reg = /(?:\?|#|&){1}([^=]*)=([^&]*)/g;
|
||||||
|
url.replace(reg, (match, key, value) => {
|
||||||
|
params[key] = value;
|
||||||
|
});
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function searchConfirm() {
|
||||||
pageData.query.page = 1;
|
pageData.query.page = 1;
|
||||||
getTable();
|
getTable();
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
onShow((opt) => {
|
/**
|
||||||
getData();
|
* 页数改变事件
|
||||||
});
|
* @param {Object} page
|
||||||
function getData() {
|
*/
|
||||||
getTable();
|
function pageChange(page) {
|
||||||
getArea();
|
pageData.query.page = page;
|
||||||
}
|
getTable();
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取桌台列表
|
|
||||||
*/
|
|
||||||
async function getTable() {
|
|
||||||
const res = await getShopTable(pageData.query);
|
|
||||||
pageData.hasAjax = true;
|
|
||||||
pageData.tabList = res.records;
|
|
||||||
pageData.totalElements = res.totalRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取区域
|
|
||||||
*/
|
|
||||||
async function getArea() {
|
|
||||||
const res = await getShopArea({ name: '', page: 1, size: 300 });
|
|
||||||
pageData.area.list = res.records;
|
|
||||||
pageData.areaMap = res.records.reduce((prve, cur) => {
|
|
||||||
prve[cur.id] = cur.name;
|
|
||||||
return prve;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型选择
|
|
||||||
* @param {Object} e
|
|
||||||
*/
|
|
||||||
function confirmStatus(e) {
|
|
||||||
console.log('---',e);
|
|
||||||
pageData.statusShow = false;
|
|
||||||
pageData.query.status = e.value[0].type;
|
|
||||||
pageData.statusName = e.value[0].label;
|
|
||||||
getTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 区域选择确定
|
|
||||||
* @param {Object} item
|
|
||||||
*/
|
|
||||||
function changeAreaSel(item) {
|
|
||||||
pageData.area.sel = item.id;
|
|
||||||
pageData.query.areaId = item.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更多操作打开
|
|
||||||
* @param {Object} table
|
|
||||||
*/
|
|
||||||
function moreShow(table) {
|
|
||||||
actionSheet.title = table.name;
|
|
||||||
actionSheet.selTable = table;
|
|
||||||
refMoreSheet.value.open();
|
|
||||||
if (actionSheet.selTable.orderId) {
|
|
||||||
getHistoryOrder({ orderId: actionSheet.selTable.orderId }).then((res) => {
|
|
||||||
pageData.orderInfo = res;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更多操作选择
|
|
||||||
* @param {Object} index
|
|
||||||
*/
|
|
||||||
async function actionSheetClick(index) {
|
|
||||||
console.log(index);
|
|
||||||
const item = actionSheet.selTable;
|
|
||||||
if (index == 0) {
|
|
||||||
if (!item.orderId) {
|
|
||||||
return uni.$utils.showToast('该桌台暂无要结账的订单!');
|
|
||||||
}
|
|
||||||
const canJieZhang = await hasPermission('允许收款');
|
|
||||||
if (!canJieZhang) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return toPay(item);
|
|
||||||
}
|
|
||||||
if (index == 1) {
|
|
||||||
//清台
|
|
||||||
return uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '确定要清台:' + item.name + '?',
|
|
||||||
success(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
shopTableClear({
|
|
||||||
id: item.id
|
|
||||||
}).then((res) => {
|
|
||||||
uni.$utils.showToast('清台成功');
|
|
||||||
pageData.query.page = 1;
|
|
||||||
getTable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (index == 2) {
|
|
||||||
return uni.$utils.showToast('待开放,请敬请期待!');
|
|
||||||
}
|
|
||||||
if (index == 3) {
|
|
||||||
return uni.$utils.showToast('待开放,请敬请期待!');
|
|
||||||
}
|
|
||||||
if (index == 4) {
|
|
||||||
//打印订单
|
|
||||||
if (!item.orderId) {
|
|
||||||
return uni.$utils.showToast('该桌台暂无要打印的订单!');
|
|
||||||
}
|
|
||||||
|
|
||||||
let res = await printOrder({ id: actionSheet.selTable.orderId, type: pageData.orderInfo.status == 'unpaid' ? 1 : 0 });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (index == 6) {
|
|
||||||
//绑定码牌
|
|
||||||
scanCode(item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.$utils.showToast('待开放,请敬请期待!');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 去结账
|
|
||||||
* @param {Object} item
|
|
||||||
*/
|
|
||||||
function toPay(item) {
|
|
||||||
go.to('PAGES_ORDER_PAY', {
|
|
||||||
tableId: item.id,
|
|
||||||
tableName: item.name,
|
|
||||||
orderId: item.orderId,
|
|
||||||
discount: 1,
|
|
||||||
userId: item.userId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定码牌
|
|
||||||
* @param {Object} item
|
|
||||||
*/
|
|
||||||
function scanCode(item) {
|
|
||||||
uni.scanCode({
|
|
||||||
onlyFromCamera: true,
|
|
||||||
success: function (res) {
|
|
||||||
console.log('条码类型:' + res.scanType);
|
|
||||||
console.log('条码内容:' + res.result);
|
|
||||||
let params = getQueryString(res.result);
|
|
||||||
shopTableBind({
|
|
||||||
tableCode: params.code,
|
|
||||||
id: item.id
|
|
||||||
}).then((res) => {
|
|
||||||
uni.$utils.showToast('桌台绑定成功');
|
|
||||||
setTimeout(() => {
|
|
||||||
getTable();
|
|
||||||
}, 1500);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解码
|
|
||||||
* @param {Object} url
|
|
||||||
*/
|
|
||||||
function getQueryString(url) {
|
|
||||||
let params = {};
|
|
||||||
// 正则表达式来匹配URL中的查询字符串
|
|
||||||
let reg = /(?:\?|#|&){1}([^=]*)=([^&]*)/g;
|
|
||||||
url.replace(reg, (match, key, value) => {
|
|
||||||
params[key] = value;
|
|
||||||
});
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索
|
|
||||||
*/
|
|
||||||
function searchConfirm() {
|
|
||||||
pageData.query.page = 1;
|
|
||||||
getTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页数改变事件
|
|
||||||
* @param {Object} page
|
|
||||||
*/
|
|
||||||
function pageChange(page) {
|
|
||||||
pageData.query.page = page;
|
|
||||||
getTable();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.fixed-top {
|
.fixed-top {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
.input-wrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
padding-top: 26rpx;
|
|
||||||
background-color: $J-bg-ff;
|
|
||||||
|
|
||||||
.input-main {
|
.input-wrapper {
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 64rpx;
|
padding-top: 26rpx;
|
||||||
|
background-color: $J-bg-ff;
|
||||||
|
|
||||||
image {
|
.input-main {
|
||||||
padding: 22rpx;
|
|
||||||
width: 26rpx;
|
|
||||||
height: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 27rpx;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
height: 64rpx;
|
||||||
|
|
||||||
::v-deep uni-button {
|
image {
|
||||||
font-size: 28rpx;
|
padding: 22rpx;
|
||||||
color: $my-main-color;
|
width: 26rpx;
|
||||||
background: rgba(255, 255, 255, 1);
|
height: 26rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep.uni-easyinput {
|
input {
|
||||||
.uni-easyinput__content {
|
flex: 1;
|
||||||
background-color: $J-bg-f5 !important;
|
font-size: 27rpx;
|
||||||
border-radius: $J-b-r12;
|
}
|
||||||
|
|
||||||
.uni-easyinput__content-input {
|
::v-deep uni-button {
|
||||||
padding-left: 0 !important;
|
font-size: 28rpx;
|
||||||
|
color: $my-main-color;
|
||||||
|
background: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.uni-input-input {
|
::v-deep.uni-easyinput {
|
||||||
border-radius: $J-b-r12 !important;
|
.uni-easyinput__content {
|
||||||
overflow: hidden !important;
|
background-color: $J-bg-f5 !important;
|
||||||
|
border-radius: $J-b-r12;
|
||||||
|
|
||||||
|
.uni-easyinput__content-input {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
|
||||||
|
.uni-input-input {
|
||||||
|
border-radius: $J-b-r12 !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-input-placeholder {
|
||||||
|
font-size: 27rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-icons {
|
||||||
|
color: rgba(230, 230, 230, 1) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-input-placeholder {
|
|
||||||
font-size: 27rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-icons {
|
|
||||||
color: rgba(230, 230, 230, 1) !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.table-type {
|
.table-type {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 0 10rpx 0 10rpx;
|
padding: 0 10rpx 0 10rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
width: 25%;
|
width: 25%;
|
||||||
margin-bottom: 10rpx;
|
margin-bottom: 10rpx;
|
||||||
|
|
||||||
.box {
|
|
||||||
position: relative;
|
|
||||||
padding: 10rpx;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 2px;
|
|
||||||
border-radius: 2px;
|
|
||||||
right: -20rpx;
|
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-of-type(4n) {
|
|
||||||
.box::after {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.sel {
|
|
||||||
.box {
|
.box {
|
||||||
background-color: rgba(255, 255, 255, 0.6);
|
position: relative;
|
||||||
|
padding: 10rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
content: '';
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
right: -20rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-of-type(4n) {
|
||||||
|
.box::after {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.sel {
|
||||||
|
.box {
|
||||||
|
background-color: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
.search-box {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 16rpx 0;
|
padding: 16rpx 0;
|
||||||
display: flex;
|
|
||||||
.search-btn {
|
|
||||||
padding: 0 30rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
// width: 164rpx;
|
.search-btn {
|
||||||
transition: all 0.3s ease-in-out;
|
padding: 0 30rpx;
|
||||||
background-color: rgb(247, 247, 247);
|
box-sizing: border-box;
|
||||||
border-radius: 100px;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
// width: 164rpx;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
background-color: rgb(247, 247, 247);
|
||||||
|
border-radius: 100px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 100%;
|
top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-arrow-down-fill {
|
.icon-arrow-down-fill {
|
||||||
width: 16rpx;
|
width: 16rpx;
|
||||||
height: 10rpx;
|
height: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
// margin-top: 52px;
|
// margin-top: 52px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,9 @@
|
|||||||
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
|
<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="info u-flex u-row-between u-col-top u-flex-col">
|
||||||
<view class="limit-discount" v-if="is_time_discount">限时折扣</view>
|
<view class="limit-discount" v-if="is_time_discount">限时折扣</view>
|
||||||
|
<view class="nowStockerNumber" v-if="data.isAutoSoldStock&&nowStockerNumber<=10&&nowStockerNumber>0">
|
||||||
|
剩余库存:{{nowStockerNumber}}
|
||||||
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<text class="up-line-1">{{ data.name }}</text>
|
<text class="up-line-1">{{ data.name }}</text>
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
<image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode="">
|
<image src="/pagesCreateOrder/static/images/icon-reduce.svg" class="icon" mode="">
|
||||||
</image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-font-32" >
|
<view class="u-font-32">
|
||||||
{{ data.chooseNumber.toFixed(2) }}
|
{{ data.chooseNumber.toFixed(2) }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
<view class="isSellout" v-else-if="data.isSoldStock == 1">
|
<view class="isSellout" v-else-if="data.isSoldStock == 1">
|
||||||
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image>
|
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-sold.svg" mode=""></image>
|
||||||
</view>
|
</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>
|
<image class="isSellout_icon" src="/pagesCreateOrder/static/images/no-stock.svg" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -107,6 +109,10 @@
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
consStockList: {
|
||||||
|
type: Array,
|
||||||
|
default:[]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//判断是否是时间折扣商品
|
//判断是否是时间折扣商品
|
||||||
@@ -156,12 +162,54 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
(item.isStock == 1 && item.stockNumber <= 0) ||
|
!consStockisFull(item) ||
|
||||||
item.isSoldStock == 1 ||
|
item.isSoldStock == 1 ||
|
||||||
item.isSale == 0 ||
|
item.isSale == 0 ||
|
||||||
!isProductAvailable(item.days, item.startTime, item.endTime)
|
!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
|
||||||
|
});
|
||||||
|
}).map(v=>{
|
||||||
|
const cItem=props.data.consList.find(c=>c.consInfoId==v.consId)
|
||||||
|
const goodsNumber=Math.floor(v.stockNumber/cItem.surplusStock)
|
||||||
|
console.log('props.data',props.data.name);
|
||||||
|
console.log('goodsNumber',goodsNumber);
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
goodsNumber
|
||||||
|
}
|
||||||
|
}).sort((a,b)=>{
|
||||||
|
return a.goodsNumber-b.goodsNumber
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const nowStockerNumber=computed(()=>{
|
||||||
|
return conslist.value[0]?conslist.value[0].goodsNumber:9999
|
||||||
|
})
|
||||||
|
function consStockisFull(item) {
|
||||||
|
if(!item.isAutoSoldStock){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 判断:最小库存 > 每份消耗库存 → 返回 true,否则 false
|
||||||
|
if (nowStockerNumber.value>=1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断商品是否在可售时间内
|
// 判断商品是否在可售时间内
|
||||||
function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) {
|
function isProductAvailable(sellDaysStr, startTimeStr, endTimeStr) {
|
||||||
// 将后端返回的字符串转换为数组
|
// 将后端返回的字符串转换为数组
|
||||||
@@ -306,4 +354,14 @@
|
|||||||
color: rgba(255, 255, 255, 0.8);
|
color: rgba(255, 255, 255, 0.8);
|
||||||
text-decoration: line-through;
|
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>
|
</style>
|
||||||
@@ -36,9 +36,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
|
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
|
||||||
@scroll="rightScroll"
|
@scroll="rightScroll" @scrolltoupper="scrolltoupper">
|
||||||
@scrolltoupper="scrolltoupper"
|
|
||||||
>
|
|
||||||
<view class="page-view u-p-l-24">
|
<view class="page-view u-p-l-24">
|
||||||
<view class="list-tight-top">
|
<view class="list-tight-top">
|
||||||
<template v-if="lingshi.show">
|
<template v-if="lingshi.show">
|
||||||
@@ -62,7 +60,7 @@
|
|||||||
<view class="item-container">
|
<view class="item-container">
|
||||||
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
|
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
|
||||||
<list-goods-item :limitTimeDiscount="data.limitTimeDiscount"
|
<list-goods-item :limitTimeDiscount="data.limitTimeDiscount"
|
||||||
@chooseGuige="chooseGuige($event, index)"
|
:consStockList="consStockList" @chooseGuige="chooseGuige($event, index)"
|
||||||
@add="goodsUpdate($event, index, true)"
|
@add="goodsUpdate($event, index, true)"
|
||||||
@reduce="goodsUpdate($event, index, false)" @tapweigh="tapweigh($event, index)"
|
@reduce="goodsUpdate($event, index, false)" @tapweigh="tapweigh($event, index)"
|
||||||
:index="goodsIndex" :data="goodsItem"></list-goods-item>
|
: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-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">
|
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
|
||||||
<list-goods-item :img="{ width: '330rpx', height: '330rpx' }"
|
<list-goods-item :img="{ width: '330rpx', height: '330rpx' }"
|
||||||
:limitTimeDiscount="data.limitTimeDiscount"
|
:consStockList="consStockList" :limitTimeDiscount="data.limitTimeDiscount"
|
||||||
@chooseGuige="chooseGuige(goodsItem.goodsIndex, goodsItem.index)"
|
@chooseGuige="chooseGuige(goodsItem.goodsIndex, goodsItem.index)"
|
||||||
@add="searchGoodsUpdate(goodsItem, goodsIndex, true)"
|
@add="searchGoodsUpdate(goodsItem, goodsIndex, true)"
|
||||||
@reduce="searchGoodsUpdate(goodsItem, goodsIndex, false)"
|
@reduce="searchGoodsUpdate(goodsItem, goodsIndex, false)"
|
||||||
@@ -98,8 +96,7 @@
|
|||||||
<view class="bottom w-full">
|
<view class="bottom w-full">
|
||||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :table="data.table"
|
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :table="data.table"
|
||||||
:data="cars" :orderInfo="data.orderInfo" :limitTimeDiscount="data.limitTimeDiscount"
|
:data="cars" :orderInfo="data.orderInfo" :limitTimeDiscount="data.limitTimeDiscount"
|
||||||
@changeNumber="goodsChangeNumber"
|
@changeNumber="goodsChangeNumber" @clear="cleaCart"></my-car>
|
||||||
@clear="cleaCart"></my-car>
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 套餐选择规格 -->
|
<!-- 套餐选择规格 -->
|
||||||
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
|
<taocanModel ref="taocanModelRef" @confirm="taocanConfirm" :goodsData="selGoods"></taocanModel>
|
||||||
@@ -117,7 +114,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 修改购物车数量 -->
|
<!-- 修改购物车数量 -->
|
||||||
<popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data" @confirm="carsNumberChange"></popupChangeNumber>
|
<popupChangeNumber v-model="popupChangeNumberData.show" :goods="popupChangeNumberData.data"
|
||||||
|
@confirm="carsNumberChange"></popupChangeNumber>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -145,9 +143,9 @@
|
|||||||
} from '@/http/api/product/stick.js'
|
} from '@/http/api/product/stick.js'
|
||||||
import popupChangeNumber from './components/popup-change-number.vue'
|
import popupChangeNumber from './components/popup-change-number.vue'
|
||||||
|
|
||||||
const popupChangeNumberData=reactive({
|
const popupChangeNumberData = reactive({
|
||||||
show:false,
|
show: false,
|
||||||
data:null
|
data: null
|
||||||
})
|
})
|
||||||
|
|
||||||
import guigeModel from "./components/guige";
|
import guigeModel from "./components/guige";
|
||||||
@@ -174,8 +172,8 @@
|
|||||||
limitTimeDiscount
|
limitTimeDiscount
|
||||||
} from "@/http/api/market/limitTimeDiscount.js";
|
} from "@/http/api/market/limitTimeDiscount.js";
|
||||||
provide("yskUtils", yskUtils);
|
provide("yskUtils", yskUtils);
|
||||||
const shopInfo = reactive({}) ;
|
const shopInfo = reactive({});
|
||||||
Object.assign(shopInfo,uni.getStorageSync("shopInfo"))
|
Object.assign(shopInfo, uni.getStorageSync("shopInfo"))
|
||||||
provide("shopInfo", uni.getStorageSync("shopInfo"));
|
provide("shopInfo", uni.getStorageSync("shopInfo"));
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -196,6 +194,9 @@
|
|||||||
cancelOrder,
|
cancelOrder,
|
||||||
rmPlaceOrder,
|
rmPlaceOrder,
|
||||||
} from "@/http/api/order.js";
|
} from "@/http/api/order.js";
|
||||||
|
import {
|
||||||
|
getConsStock
|
||||||
|
} from '@/http/api/cons.js'
|
||||||
|
|
||||||
const modal = reactive({
|
const modal = reactive({
|
||||||
key: "",
|
key: "",
|
||||||
@@ -349,6 +350,24 @@
|
|||||||
let $originGoods = [];
|
let $originGoods = [];
|
||||||
let $category = [];
|
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() {
|
async function init() {
|
||||||
if (option.type == "add") {
|
if (option.type == "add") {
|
||||||
setTabBar($category, $originGoods, []);
|
setTabBar($category, $originGoods, []);
|
||||||
@@ -356,7 +375,7 @@
|
|||||||
let shopInfoRes = await getShopInfo({
|
let shopInfoRes = await getShopInfo({
|
||||||
id: uni.getStorageSync("shopInfo").id
|
id: uni.getStorageSync("shopInfo").id
|
||||||
});
|
});
|
||||||
Object.assign(shopInfo,shopInfoRes)
|
Object.assign(shopInfo, shopInfoRes)
|
||||||
uni.setStorageSync("shopInfo", shopInfoRes);
|
uni.setStorageSync("shopInfo", shopInfoRes);
|
||||||
// 获取分类数据
|
// 获取分类数据
|
||||||
let categoryRes = await categoryPage({
|
let categoryRes = await categoryPage({
|
||||||
@@ -364,6 +383,8 @@
|
|||||||
size: 300
|
size: 300
|
||||||
});
|
});
|
||||||
$category = categoryRes.records;
|
$category = categoryRes.records;
|
||||||
|
// 获取耗材数据
|
||||||
|
await getCons()
|
||||||
// 获取商品数据
|
// 获取商品数据
|
||||||
const goodsRes = await getGoods();
|
const goodsRes = await getGoods();
|
||||||
const goods = goodsRes.filter((v) => {
|
const goods = goodsRes.filter((v) => {
|
||||||
@@ -387,6 +408,8 @@
|
|||||||
initCart();
|
initCart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const allHistoryOrder = ref([])
|
||||||
/**
|
/**
|
||||||
* 获取订单详情
|
* 获取订单详情
|
||||||
*/
|
*/
|
||||||
@@ -409,13 +432,13 @@
|
|||||||
|
|
||||||
console.log("data.historyOrder===", data.historyOrder);
|
console.log("data.historyOrder===", data.historyOrder);
|
||||||
|
|
||||||
let allHistoryOrder = data.historyOrder.map((item) => {
|
allHistoryOrder.value = data.historyOrder.map((item) => {
|
||||||
return [...item.info];
|
return [...item.info];
|
||||||
});
|
}).flat();
|
||||||
|
|
||||||
// console.log('allHistoryOrder===', allHistoryOrder.flat());
|
// console.log('allHistoryOrder===', allHistoryOrder.flat());
|
||||||
data.historyOrderNum = 0;
|
data.historyOrderNum = 0;
|
||||||
allHistoryOrder.flat().map((item) => {
|
allHistoryOrder.value.map((item) => {
|
||||||
data.historyOrderNum += item.num;
|
data.historyOrderNum += item.num;
|
||||||
});
|
});
|
||||||
// console.log('data.historyOrderNum===', data.historyOrderNum);
|
// console.log('data.historyOrderNum===', data.historyOrderNum);
|
||||||
@@ -741,7 +764,22 @@
|
|||||||
}
|
}
|
||||||
// initCart()
|
// 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
|
* @param {Object} foodsindex
|
||||||
@@ -800,6 +838,34 @@
|
|||||||
//更新
|
//更新
|
||||||
let cartItem = cars[goodsInCarIndex];
|
let cartItem = cars[goodsInCarIndex];
|
||||||
let number = isAdd ? cartItem.number + 1 : +cartItem.number - 1;
|
let number = isAdd ? cartItem.number + 1 : +cartItem.number - 1;
|
||||||
|
if (isAdd) {
|
||||||
|
if (allHistoryOrder.value.find(v => v.productId == $goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + $goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (number == 2) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + $goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!isAdd) {
|
if (!isAdd) {
|
||||||
if (number === 0 || number < suitNum) {
|
if (number === 0 || number < suitNum) {
|
||||||
//移除
|
//移除
|
||||||
@@ -828,6 +894,7 @@
|
|||||||
data.isGoodsAdd = false;
|
data.isGoodsAdd = false;
|
||||||
setSearchGoods(searchGoodsIndex, number);
|
setSearchGoods(searchGoodsIndex, number);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// 不影响之前的代码 称重suit单独处理
|
// 不影响之前的代码 称重suit单独处理
|
||||||
if ($goods.type == "weight" && showCurrentInput) {
|
if ($goods.type == "weight" && showCurrentInput) {
|
||||||
suitNum = showCurrentInput;
|
suitNum = showCurrentInput;
|
||||||
@@ -839,6 +906,16 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (allHistoryOrder.value.find(v => v.productId == $goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + $goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
// 套餐和单规格
|
// 套餐和单规格
|
||||||
if ($goods.groupType != 1) {
|
if ($goods.groupType != 1) {
|
||||||
//增加
|
//增加
|
||||||
@@ -862,10 +939,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function goodsChangeNumber(e){
|
function goodsChangeNumber(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
popupChangeNumberData.data=e;
|
popupChangeNumberData.data = e;
|
||||||
popupChangeNumberData.show=true
|
popupChangeNumberData.show = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -937,8 +1014,7 @@
|
|||||||
tabbarItem.foods.find((v) => v.id == e.goods.product_id);
|
tabbarItem.foods.find((v) => v.id == e.goods.product_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$sku = !e.goods.product_id ?
|
$sku = !e.goods.product_id ? {
|
||||||
{
|
|
||||||
suitNum: 1
|
suitNum: 1
|
||||||
} :
|
} :
|
||||||
$goods.skuList.find((v) => v.id == e.goods.sku_id);
|
$goods.skuList.find((v) => v.id == e.goods.sku_id);
|
||||||
@@ -1018,13 +1094,22 @@
|
|||||||
* @param {Object} skuList
|
* @param {Object} skuList
|
||||||
*/
|
*/
|
||||||
function returnSelGoodsSkuList(selectSpecInfo) {
|
function returnSelGoodsSkuList(selectSpecInfo) {
|
||||||
|
// 👇 修复:如果是字符串,转成对象
|
||||||
|
if (typeof selectSpecInfo === 'string') {
|
||||||
|
selectSpecInfo = JSON.parse(selectSpecInfo);
|
||||||
|
}
|
||||||
|
|
||||||
let specInfo = [];
|
let specInfo = [];
|
||||||
|
console.log('selectSpecInfo', selectSpecInfo);
|
||||||
|
|
||||||
for (var key in selectSpecInfo) {
|
for (var key in selectSpecInfo) {
|
||||||
|
console.log('key', key); // 现在会正确打印:口味、汤
|
||||||
specInfo.push({
|
specInfo.push({
|
||||||
name: key,
|
name: key,
|
||||||
value: selectSpecInfo[key],
|
value: selectSpecInfo[key],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = specInfo.map((v, index) => {
|
let result = specInfo.map((v, index) => {
|
||||||
return {
|
return {
|
||||||
...v,
|
...v,
|
||||||
@@ -1062,9 +1147,30 @@
|
|||||||
} = res;
|
} = res;
|
||||||
let carGoods = cars[index];
|
let carGoods = cars[index];
|
||||||
let cartId = carGoods.id;
|
let cartId = carGoods.id;
|
||||||
let newNumber = carGoods.number * 1 + suitNum;
|
|
||||||
let suitNum = goods.skuList[0].suitNum || 1;
|
let suitNum = goods.skuList[0].suitNum || 1;
|
||||||
|
let newNumber = carGoods.number * 1 + suitNum;
|
||||||
|
|
||||||
|
if (allHistoryOrder.value.find(v => v.productId == goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (newNumber == 2 && carGoods.number < newNumber) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复?',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
editCart({
|
editCart({
|
||||||
id: cartId,
|
id: cartId,
|
||||||
number: newNumber,
|
number: newNumber,
|
||||||
@@ -1079,6 +1185,17 @@
|
|||||||
);
|
);
|
||||||
data.isGoodsAdd = false;
|
data.isGoodsAdd = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if (allHistoryOrder.value.find(v => v.productId == goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
//添加
|
//添加
|
||||||
editCart({
|
editCart({
|
||||||
number: suitNum,
|
number: suitNum,
|
||||||
@@ -1106,8 +1223,7 @@
|
|||||||
return carsGoods.sku_id == sku_id && carsGoods.product_id == product_id;
|
return carsGoods.sku_id == sku_id && carsGoods.product_id == product_id;
|
||||||
});
|
});
|
||||||
const carGoods = cars[goodsInCarIndex];
|
const carGoods = cars[goodsInCarIndex];
|
||||||
return carGoods ?
|
return carGoods ? {
|
||||||
{
|
|
||||||
index: goodsInCarIndex,
|
index: goodsInCarIndex,
|
||||||
carGoods,
|
carGoods,
|
||||||
} :
|
} :
|
||||||
@@ -1359,37 +1475,37 @@
|
|||||||
|
|
||||||
function toStick() {
|
function toStick() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ["album", "camera "],
|
sourceType: ["album", "camera "],
|
||||||
success: async function (res) {
|
success: async function(res) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "上传中",
|
title: "上传中",
|
||||||
});
|
|
||||||
console.log(res);
|
|
||||||
const fileRes = await stickCount(res.tempFiles[0]);
|
|
||||||
console.log(fileRes)
|
|
||||||
uni.hideLoading();
|
|
||||||
if (fileRes) {
|
|
||||||
uni.setStorageSync('stickData',{
|
|
||||||
table:data.table,
|
|
||||||
orderInfo:data.orderInfo,
|
|
||||||
limitTimeDiscount:data.limitTimeDiscount
|
|
||||||
})
|
|
||||||
go.to("PAGES_CREATE_ORDER_STICK", {
|
|
||||||
tableCode: data.table.tableCode,
|
|
||||||
number:fileRes,
|
|
||||||
isCreateOrderToDetail:isCreateOrderToDetail.value,
|
|
||||||
});
|
});
|
||||||
|
console.log(res);
|
||||||
|
const fileRes = await stickCount(res.tempFiles[0]);
|
||||||
|
console.log(fileRes)
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fileRes) {
|
||||||
|
uni.setStorageSync('stickData', {
|
||||||
|
table: data.table,
|
||||||
|
orderInfo: data.orderInfo,
|
||||||
|
limitTimeDiscount: data.limitTimeDiscount
|
||||||
|
})
|
||||||
|
go.to("PAGES_CREATE_ORDER_STICK", {
|
||||||
|
tableCode: data.table.tableCode,
|
||||||
|
number: fileRes,
|
||||||
|
isCreateOrderToDetail: isCreateOrderToDetail.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "上传失败",
|
title: "上传失败",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1425,7 +1541,7 @@
|
|||||||
* @param {Object} index
|
* @param {Object} index
|
||||||
*/
|
*/
|
||||||
async function swichMenu(index) {
|
async function swichMenu(index) {
|
||||||
if (data.arr.length !=data.tabbar.length) {
|
if (data.arr.length != data.tabbar.length) {
|
||||||
await getMenuItemTop();
|
await getMenuItemTop();
|
||||||
}
|
}
|
||||||
if (index == data.current) return;
|
if (index == data.current) return;
|
||||||
@@ -1441,7 +1557,7 @@
|
|||||||
|
|
||||||
|
|
||||||
data.scrollRightTop = data.arr[index] + data.topZhanwei;
|
data.scrollRightTop = data.arr[index] + data.topZhanwei;
|
||||||
console.log('scrollRightTop',data.scrollRightTop );
|
console.log('scrollRightTop', data.scrollRightTop);
|
||||||
data.current = index;
|
data.current = index;
|
||||||
leftMenuStatus(index);
|
leftMenuStatus(index);
|
||||||
}
|
}
|
||||||
@@ -1518,7 +1634,7 @@
|
|||||||
arr.push(rect.top - rects[0].top);
|
arr.push(rect.top - rects[0].top);
|
||||||
});
|
});
|
||||||
data.arr = arr;
|
data.arr = arr;
|
||||||
console.log('每一项高度',data.arr);
|
console.log('每一项高度', data.arr);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.exec();
|
.exec();
|
||||||
@@ -1526,7 +1642,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function scrolltoupper(){
|
function scrolltoupper() {
|
||||||
data.current = 0;
|
data.current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1537,7 +1653,7 @@
|
|||||||
async function rightScroll(e) {
|
async function rightScroll(e) {
|
||||||
|
|
||||||
data.oldScrollTop = e.detail.scrollTop;
|
data.oldScrollTop = e.detail.scrollTop;
|
||||||
if(e.detail.scrollTop<=0||e.detail.scrollTop<data.arr[1]){
|
if (e.detail.scrollTop <= 0 || e.detail.scrollTop < data.arr[1]) {
|
||||||
data.current = 0;
|
data.current = 0;
|
||||||
isTabClickOver = true;
|
isTabClickOver = true;
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,65 +1,87 @@
|
|||||||
<template>
|
<template>
|
||||||
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
|
<view>
|
||||||
<template #desc>
|
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
|
||||||
<view class="u-p-30 u-text-left">
|
<template #desc>
|
||||||
<view>
|
<view class="u-p-30 u-text-left">
|
||||||
{{data.productName}}
|
<view>
|
||||||
</view>
|
{{data.productName}}
|
||||||
<view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}">
|
|
||||||
<up-number-box :min="0" :max="maxNum" :buttonSize="44" v-model="number" integer
|
|
||||||
:disabled="data.productId=='-999'">
|
|
||||||
<template #minus>
|
|
||||||
<view class="minus number-box-btn"></view>
|
|
||||||
</template>
|
|
||||||
<template #input>
|
|
||||||
<view class="u-flex-1 u-row-center u-text-center input">
|
|
||||||
<up-input :disabled="data.productId=='-999'" @change="parseIntNumber($event,false)"
|
|
||||||
@blur="parseIntNumber($event,true)" v-model="number" border="none"
|
|
||||||
type="digit"></up-input>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template #plus>
|
|
||||||
<view class="plus number-box-btn">
|
|
||||||
<up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16"
|
|
||||||
bold></up-icon>
|
|
||||||
<up-icon v-else name="plus" color="#999" size="16" bold></up-icon>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</up-number-box>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<view class="u-font-24">
|
|
||||||
<text class="color-999">退菜理由</text>
|
|
||||||
<text class="color-red">*</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-flex-wrap u-m-t-24">
|
<view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}">
|
||||||
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
|
<up-number-box :min="0" :max="maxNum" :buttonSize="44" v-model="number" integer
|
||||||
<up-tag @click="changeTagSel(item)" :text="item.label" plain borderColor="#E6FOFF"
|
:disabled="data.productId=='-999'">
|
||||||
color="#318AFE" v-if="item.checked"> </up-tag>
|
<template #minus>
|
||||||
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#666" :text="item.label"
|
<view class="minus number-box-btn"></view>
|
||||||
plain v-else> </up-tag>
|
</template>
|
||||||
|
<template #input>
|
||||||
|
<view class="u-flex-1 u-row-center u-text-center input">
|
||||||
|
<up-input :disabled="data.productId=='-999'" @change="parseIntNumber($event,false)"
|
||||||
|
@blur="parseIntNumber($event,true)" v-model="number" border="none"
|
||||||
|
type="digit"></up-input>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template #plus>
|
||||||
|
<view class="plus number-box-btn">
|
||||||
|
<up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16"
|
||||||
|
bold></up-icon>
|
||||||
|
<up-icon v-else name="plus" color="#999" size="16" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</up-number-box>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-font-24">
|
||||||
|
<text class="color-999">退菜理由</text>
|
||||||
|
<text class="color-red">*</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-flex-wrap u-m-t-24">
|
||||||
|
<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>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-24">
|
||||||
|
<up-textarea v-model="form.note" placeholder="备注"></up-textarea>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-24">
|
</view>
|
||||||
<up-textarea v-model="form.note" placeholder="备注"></up-textarea>
|
</template>
|
||||||
|
<template #btn>
|
||||||
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<template #btn>
|
</my-model>
|
||||||
<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>
|
<up-modal :show="confirmModal.show" title="提示" @close="confirmModalClose" @cancel="confirmModalClose"
|
||||||
<view class="u-m-t-10">
|
@confirm="confirmModalConfirm" showCancelButton>
|
||||||
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
|
<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>
|
||||||
</view>
|
</view>
|
||||||
|
</up-modal>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
</template>
|
|
||||||
</my-model>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, watch } from 'vue';
|
import {
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
const emits = defineEmits(['update:show', 'confirm'])
|
const emits = defineEmits(['update:show', 'confirm'])
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -76,6 +98,22 @@
|
|||||||
default: false
|
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({
|
const form = reactive({
|
||||||
note: ''
|
note: ''
|
||||||
})
|
})
|
||||||
@@ -157,11 +195,51 @@
|
|||||||
})
|
})
|
||||||
form.note = ''
|
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 selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
|
||||||
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
|
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
|
||||||
console.log({
|
console.log({
|
||||||
@@ -171,17 +249,22 @@
|
|||||||
if (!note) {
|
if (!note) {
|
||||||
return infoBox.showToast("请输入退菜原因");
|
return infoBox.showToast("请输入退菜原因");
|
||||||
}
|
}
|
||||||
let par = {
|
const shopInfo = uni.getStorageSync('shopInfo')
|
||||||
orderId: props.data.orderId,
|
if (shopInfo.refundMode == 1) {
|
||||||
refundAmount: number.value * props.data.unitPrice,
|
const res = await getGoodsCategory(props.data)
|
||||||
refundReason: note,
|
if (res.refundMode === 3) {
|
||||||
refundDetails: [{
|
confirmModal.show = true
|
||||||
id: props.data.id,
|
return
|
||||||
returnAmount: number.value * props.data.unitPrice,
|
}
|
||||||
num: number.value,
|
|
||||||
}],
|
|
||||||
}
|
}
|
||||||
emits('confirm', par)
|
if (shopInfo.refundMode == 2) {
|
||||||
|
const res = await getProductDetail(props.data.productId)
|
||||||
|
if (res.refundMode === 3) {
|
||||||
|
confirmModal.show = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refundGoods()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view>
|
<view>
|
||||||
<text :class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}{{data.refundType?'['+$dict.getDiceName(data.refundType,'refundType')+']':''}}</text>
|
<text
|
||||||
|
:class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}{{data.refundType?'['+$dict.getDiceName(data.refundType,'refundType')+']':''}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class=" color-main">
|
<view class=" color-main">
|
||||||
@@ -33,13 +34,18 @@
|
|||||||
<view class="" v-for="(item,index) in data.goods" :key="index">
|
<view class="" v-for="(item,index) in data.goods" :key="index">
|
||||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||||
<view>
|
<view>
|
||||||
<view class=""> {{item.productName}}</view>
|
<view class="">
|
||||||
|
<text>{{item.productName}}</text>
|
||||||
|
</view>
|
||||||
<view class="color-999 u-font-24 u-m-t-8">
|
<view class="color-999 u-font-24 u-m-t-8">
|
||||||
{{item.skuName}}
|
{{item.skuName}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
|
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
|
||||||
<view style="margin-right: 10rpx;">×{{item.num}}</view>
|
<view style="margin-right: 10rpx;">
|
||||||
|
<text>×{{item.num}}</text>
|
||||||
|
<text class="color-red u-m-l-10 font-bold" v-if="item.returnNum">(退{{item.returnNum}})</text>
|
||||||
|
</view>
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text>¥{{item.unitPrice}}</text>
|
<text>¥{{item.unitPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -56,7 +62,7 @@
|
|||||||
<view class="no-wrap u-m-r-32">打包费</view>
|
<view class="no-wrap u-m-r-32">打包费</view>
|
||||||
<view>¥{{data.packFee||0}}</view>
|
<view>¥{{data.packFee||0}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 32rpx;" ></view>
|
<view style="height: 32rpx;"></view>
|
||||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||||
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
||||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||||
@@ -98,7 +104,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import {
|
||||||
|
computed,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
@@ -126,8 +137,8 @@
|
|||||||
let $goodsMap = {}
|
let $goodsMap = {}
|
||||||
let goosZhonglei = ref(0)
|
let goosZhonglei = ref(0)
|
||||||
let goodsNumber = ref(0)
|
let goodsNumber = ref(0)
|
||||||
let originAmount = computed(()=>{
|
let originAmount = computed(() => {
|
||||||
let total=0;
|
let total = 0;
|
||||||
for (let i in props.data.goods) {
|
for (let i in props.data.goods) {
|
||||||
const goods = props.data.goods[i]
|
const goods = props.data.goods[i]
|
||||||
if ($goodsMap.hasOwnProperty(goods.productId)) {
|
if ($goodsMap.hasOwnProperty(goods.productId)) {
|
||||||
@@ -142,12 +153,12 @@
|
|||||||
return total
|
return total
|
||||||
})
|
})
|
||||||
const priceSize = 9
|
const priceSize = 9
|
||||||
let minWidth=ref(36)
|
let minWidth = ref(36)
|
||||||
|
|
||||||
|
|
||||||
function computedPriceStyle() {
|
function computedPriceStyle() {
|
||||||
return {
|
return {
|
||||||
'min-width':minWidth.value + 'px'
|
'min-width': minWidth.value + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,19 @@
|
|||||||
<view class="min-page bg-gray u-p-30">
|
<view class="min-page bg-gray u-p-30">
|
||||||
<view class="bg-fff u-p-l-30 u-p-r-30 ">
|
<view class="bg-fff u-p-l-30 u-p-r-30 ">
|
||||||
<view class="myTabs u-m-t-20">
|
<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>
|
</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;">
|
<view v-if="pageData.tabsIndex == 2" class="bg-fff u-p-24 border-r-12 u-flex u-row-between"
|
||||||
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround" v-model="pageData.modify" >
|
style="margin-top: 30rpx;">
|
||||||
|
<up-input type="digit" placeholder="请输入退款金额" @change="parseIntNumber($event)" border="surround"
|
||||||
|
v-model="pageData.modify">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<up-text text="¥" margin="0 3px 0 0" type="tips" ></up-text>
|
<up-text text="¥" margin="0 3px 0 0" type="tips"></up-text>
|
||||||
</template>
|
</template>
|
||||||
</up-input>
|
</up-input>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-24 u-font-24 u-font-24">
|
<view class="u-m-t-24 u-font-24 u-font-24">
|
||||||
<text class="color-red">*</text>
|
<text class="color-red">*</text>
|
||||||
@@ -27,7 +30,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<template v-if="item.productId=='-999'">
|
<template v-if="item.productId=='-999'">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="color-red" >¥{{item.priceAmount}}</view>
|
<view class="color-red">¥{{item.priceAmount}}</view>
|
||||||
<view class="u-flex u-m-l-32 u-col-center">
|
<view class="u-flex u-m-l-32 u-col-center">
|
||||||
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
|
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -47,19 +50,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="!option.userCouponId">
|
<template v-if="!option.userCouponId">
|
||||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
||||||
<view>支付金额</view>
|
<view>支付金额</view>
|
||||||
<view>
|
<view>
|
||||||
{{to2(orderDetail.info.payAmount)}}元
|
{{to2(orderDetail.info.payAmount)}}元
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
||||||
<view>剩余可退金额</view>
|
<view>剩余可退金额</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
{{to2(orderDetail.info.payAmount - orderDetail.info.refundAmount)}}元
|
{{to2(orderDetail.info.payAmount - orderDetail.info.refundAmount)}}元
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
|
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
||||||
<view>退款金额</view>
|
<view>退款金额</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
{{to2(pageData.tabsIndex == 1 ? alltuikuanPrice : (pageData.tabsIndex == 2 ? pageData.modify : tuikuanPrice))}}元
|
{{to2(pageData.tabsIndex == 1 ? alltuikuanPrice : (pageData.tabsIndex == 2 ? pageData.modify : tuikuanPrice))}}元
|
||||||
@@ -96,35 +99,67 @@
|
|||||||
:color="$utils.ColorMain"></up-button>
|
:color="$utils.ColorMain"></up-button>
|
||||||
</view>
|
</view>
|
||||||
<confirmRefundPopup ref="refundPopup" />
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import {
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
computed,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
import confirmRefundPopup from './components/confirmRefundPopup.vue';
|
import confirmRefundPopup from './components/confirmRefundPopup.vue';
|
||||||
|
|
||||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
import {
|
||||||
import { refundOrder } from '@/http/api/order.js'
|
hasPermission
|
||||||
import { mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
} from '@/commons/utils/hasPermission.js'
|
||||||
|
import {
|
||||||
|
refundOrder
|
||||||
|
} from '@/http/api/order.js'
|
||||||
|
import {
|
||||||
|
mathFloorPrice
|
||||||
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
let note = ref('')
|
let note = ref('')
|
||||||
const tuikuan = reactive({
|
const tuikuan = reactive({
|
||||||
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
||||||
sel: -1
|
sel: -1
|
||||||
})
|
})
|
||||||
const pageData = reactive({
|
const pageData = reactive({
|
||||||
tabsList: [
|
tabsList: [{
|
||||||
{label: '部分退款', value: 0},
|
label: '部分退款',
|
||||||
{label: '全部退款', value: 1},
|
value: 0
|
||||||
{label: '自定义退款', value: 2},
|
},
|
||||||
|
{
|
||||||
|
label: '全部退款',
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '自定义退款',
|
||||||
|
value: 2
|
||||||
|
},
|
||||||
],
|
],
|
||||||
tabsIndex: 0,
|
tabsIndex: 0,
|
||||||
modify: '',
|
modify: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const option=reactive({
|
const option = reactive({
|
||||||
productId:'-999'
|
productId: '-999'
|
||||||
})
|
})
|
||||||
const orderDetail = reactive({
|
const orderDetail = reactive({
|
||||||
goodsList: [],
|
goodsList: [],
|
||||||
@@ -148,17 +183,17 @@
|
|||||||
*/
|
*/
|
||||||
function tabsChange(i) {
|
function tabsChange(i) {
|
||||||
pageData.tabsIndex = pageData.tabsList[i].value
|
pageData.tabsIndex = pageData.tabsList[i].value
|
||||||
if( pageData.tabsIndex == 0){ // 部分退款
|
if (pageData.tabsIndex == 0) { // 部分退款
|
||||||
orderDetail.goodsList.map(v => {
|
orderDetail.goodsList.map(v => {
|
||||||
v.number = '0.00'
|
v.number = '0.00'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if( pageData.tabsIndex == 1){ // 全部退款
|
if (pageData.tabsIndex == 1) { // 全部退款
|
||||||
orderDetail.goodsList.map(v => {
|
orderDetail.goodsList.map(v => {
|
||||||
v.number = v.num.toFixed(2)
|
v.number = v.num.toFixed(2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if( pageData.tabsIndex == 2){ // 自定义退款
|
if (pageData.tabsIndex == 2) { // 自定义退款
|
||||||
orderDetail.goodsList.map(v => {
|
orderDetail.goodsList.map(v => {
|
||||||
v.number = '0.00'
|
v.number = '0.00'
|
||||||
})
|
})
|
||||||
@@ -168,11 +203,12 @@
|
|||||||
function changeTuiKuanSel(i) {
|
function changeTuiKuanSel(i) {
|
||||||
tuikuan.sel = i
|
tuikuan.sel = i
|
||||||
}
|
}
|
||||||
function parseIntNumber (e) {
|
|
||||||
if ( e > (orderDetail.info.payAmount - orderDetail.info.refundAmount) ) {
|
function parseIntNumber(e) {
|
||||||
setTimeout(()=>{
|
if (e > (orderDetail.info.payAmount - orderDetail.info.refundAmount)) {
|
||||||
|
setTimeout(() => {
|
||||||
pageData.modify = (orderDetail.info.payAmount - orderDetail.info.refundAmount).toFixed(2)
|
pageData.modify = (orderDetail.info.payAmount - orderDetail.info.refundAmount).toFixed(2)
|
||||||
},100)
|
}, 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -198,7 +234,7 @@
|
|||||||
*/
|
*/
|
||||||
const tuikuanPrice = computed(() => {
|
const tuikuanPrice = computed(() => {
|
||||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||||
const n= mathFloorPrice(cur.number * cur.unitPrice,cur)
|
const n = mathFloorPrice(cur.number * cur.unitPrice, cur)
|
||||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)
|
return (parseFloat(prve) + parseFloat(n)).toFixed(2)
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
@@ -208,8 +244,8 @@
|
|||||||
*/
|
*/
|
||||||
const surplusRefundPrice = computed(() => {
|
const surplusRefundPrice = computed(() => {
|
||||||
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
||||||
const n = parseFloat( mathFloorPrice(cur.refundNum * cur.unitPrice,cur))
|
const n = parseFloat(mathFloorPrice(cur.refundNum * cur.unitPrice, cur))
|
||||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)*1
|
return (parseFloat(prve) + parseFloat(n)).toFixed(2) * 1
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -218,8 +254,8 @@
|
|||||||
*/
|
*/
|
||||||
const alltuikuanPrice = computed(() => {
|
const alltuikuanPrice = computed(() => {
|
||||||
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
return orderDetail.info.payAmount - orderDetail.goodsList.reduce((prve, cur) => {
|
||||||
const n = parseFloat( mathFloorPrice(cur.refundNum * cur.unitPrice,cur))
|
const n = parseFloat(mathFloorPrice(cur.refundNum * cur.unitPrice, cur))
|
||||||
return (parseFloat(prve) + parseFloat(n)).toFixed(2)*1
|
return (parseFloat(prve) + parseFloat(n)).toFixed(2) * 1
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -228,13 +264,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeItem(item, step) {
|
function changeItem(item, step) {
|
||||||
if( item.num <= 0){
|
if (item.num <= 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(item.productId=='-999'){
|
if (item.productId == '-999') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if( pageData.tabsIndex != 0) {
|
if (pageData.tabsIndex != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let newval = item.number * 1 + step * 1;
|
let newval = item.number * 1 + step * 1;
|
||||||
@@ -255,16 +291,16 @@
|
|||||||
*/
|
*/
|
||||||
let params;
|
let params;
|
||||||
async function tuikuanConfirm() {
|
async function tuikuanConfirm() {
|
||||||
const canTuikuan=await hasPermission('允许退款')
|
const canTuikuan = await hasPermission('允许退款')
|
||||||
if(!canTuikuan){
|
if (!canTuikuan) {
|
||||||
return uni.$utils.showToast('您没有退款权限')
|
return uni.$utils.showToast('您没有退款权限')
|
||||||
}
|
}
|
||||||
if (pageData.tabsIndex != 2&&tuikuanNumber.value <= 0) {
|
if (pageData.tabsIndex != 2 && tuikuanNumber.value <= 0) {
|
||||||
return uni.$utils.showToast('退款商品数量不能为0!')
|
return uni.$utils.showToast('退款商品数量不能为0!')
|
||||||
}
|
}
|
||||||
|
|
||||||
const selTag=tuikuan.list[tuikuan.sel]
|
const selTag = tuikuan.list[tuikuan.sel]
|
||||||
const noteResult=`${selTag?selTag:''}${note.value?(','+note.value):''}`
|
const noteResult = `${selTag?selTag:''}${note.value?(','+note.value):''}`
|
||||||
if (!noteResult) {
|
if (!noteResult) {
|
||||||
return uni.$utils.showToast('请输入或选择退款原因!')
|
return uni.$utils.showToast('请输入或选择退款原因!')
|
||||||
}
|
}
|
||||||
@@ -272,42 +308,103 @@
|
|||||||
params = {
|
params = {
|
||||||
orderId: option.orderId,
|
orderId: option.orderId,
|
||||||
refundReason: noteResult,
|
refundReason: noteResult,
|
||||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
refundStock: confirmModal.selRefundStock,
|
||||||
|
refundDetails: orderDetail.goodsList.filter(v => v.number * 1).map(v => {
|
||||||
return {
|
return {
|
||||||
id:v.id,
|
id: v.id,
|
||||||
returnAmount: v.number * 1 * v.unitPrice,
|
returnAmount: v.number * 1 * v.unitPrice,
|
||||||
num: v.number * 1
|
num: v.number * 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if( pageData.tabsIndex == 2){
|
if (pageData.tabsIndex == 2) {
|
||||||
params.modify = true
|
params.modify = true
|
||||||
params.refundAmount = (pageData.modify*1).toFixed(2)
|
params.refundAmount = (pageData.modify * 1).toFixed(2)
|
||||||
} else {
|
} else {
|
||||||
params.modify = false
|
params.modify = false
|
||||||
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
|
params.refundAmount = pageData.tabsIndex == 1 ? alltuikuanPrice.value : tuikuanPrice.value
|
||||||
}
|
}
|
||||||
if ( pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount){
|
if (pageData.tabsIndex == 2 && params.refundAmount > orderDetail.info.payAmount) {
|
||||||
return uni.$utils.showToast('退款金额不能大于付款金额!')
|
return uni.$utils.showToast('退款金额不能大于付款金额!')
|
||||||
}
|
}
|
||||||
if( uni.getStorageSync("shopInfo").isReturnPwd == 1){
|
if (uni.getStorageSync("shopInfo").isReturnPwd == 1) {
|
||||||
refundPopup.value.open(params.refundAmount, refundPost);
|
refundPopup.value.open(params.refundAmount, refundPost);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
refundPost()
|
refundPost()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refundPost (payPassword) {
|
|
||||||
if( payPassword ){
|
import {
|
||||||
params.pwd = payPassword
|
getProductList,
|
||||||
}
|
getCategoryList
|
||||||
await refundOrder(params)
|
} from '@/http/api/product.js'
|
||||||
uni.$utils.showToast('退款请求提交成功')
|
|
||||||
setTimeout(()=>{
|
const confirmModal = reactive({
|
||||||
uni.navigateBack({delta:1})
|
show: false,
|
||||||
},500)
|
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
|
||||||
|
})
|
||||||
|
}, 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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user