代码更新
This commit is contained in:
parent
4f65b08c06
commit
490c513f48
|
|
@ -0,0 +1,136 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取挂账人分页
|
||||
* @returns
|
||||
*/
|
||||
export function getCreditBuyerPage(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挂账人详情
|
||||
* @returns
|
||||
*/
|
||||
export function getCreditBuyerDetail(id, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/${id}`,
|
||||
method: "GET",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function addCreditBuyer(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function editCreditBuyer(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function delCreditBuyer(id, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/${id}`,
|
||||
method: "DELETE",
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 还款
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerRepayment(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyer/repayment`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/pay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 还款记录
|
||||
* @returns
|
||||
*/
|
||||
export function creditRePaymentRecord(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/paymentRecord/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细分页
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderList(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/page`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细统计
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderSummary(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/credit/buyerOrder/summary`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
14
api/cons.js
14
api/cons.js
|
|
@ -178,3 +178,17 @@ export function stockCheck(data, urlType = 'product') {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材报损
|
||||
* @returns
|
||||
*/
|
||||
export function stockReportDamage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/stock/reportDamage`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
15
api/order.js
15
api/order.js
|
|
@ -71,4 +71,19 @@ export function refundOrder(data, urlType = 'order') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单打印
|
||||
* @returns
|
||||
*/
|
||||
export function printOrder(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/order/print`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
14
api/pay.js
14
api/pay.js
|
|
@ -57,6 +57,20 @@ export function microPay(data, urlType = 'order') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账支付
|
||||
* @returns
|
||||
*/
|
||||
export function creditPay(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/pay/creditPay`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员支付
|
||||
* @returns
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 获取订单可用积分及抵扣金额(支付页面使用)
|
||||
* @returns
|
||||
*/
|
||||
export function calcUsablePoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/calcUsablePoints`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据积分计算可抵扣金额
|
||||
* @returns
|
||||
*/
|
||||
export function calcDeductionAmount(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/calcDeductionAmount`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付完成扣减积分
|
||||
* @returns
|
||||
*/
|
||||
export function payedDeductPoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/payedDeductPoints`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消费赠送积分
|
||||
* @returns
|
||||
*/
|
||||
export function consumeAwardPoints(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/points/memberPoints/consumeAwardPoints`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -108,6 +108,22 @@ export function productBindCons(data, urlType = 'product') {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品报损
|
||||
* @returns
|
||||
*/
|
||||
export function productReportDamage(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/reportDamage`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 商品分类----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 商品销售汇总
|
||||
* @returns
|
||||
*/
|
||||
export function productSaleDate(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/data/summary/productSaleDate`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
14
api/table.js
14
api/table.js
|
|
@ -29,6 +29,20 @@ export function getShopTableDetail(data, urlType = 'account') {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌清台
|
||||
* @returns
|
||||
*/
|
||||
export function shopTableClear(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopTable/clear`,
|
||||
method: "PUT",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 台桌绑定
|
||||
* @returns
|
||||
|
|
|
|||
|
|
@ -17,15 +17,34 @@ export function canTuicai(orderInfo, item) {
|
|||
return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return'
|
||||
}
|
||||
export function canTuiKuan(orderInfo, item) {
|
||||
return orderInfo.status == 'done' && item.status != 'return' && item.status != 'refund' && item.status !=
|
||||
'refunding'
|
||||
if( item ){
|
||||
return orderInfo.status == 'done' && item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
|
||||
} else {
|
||||
let goodsList = []
|
||||
let data = false;
|
||||
Object.entries(orderInfo.detailMap).map(([key, value]) => (
|
||||
goodsList = [...goodsList,...value]
|
||||
))
|
||||
console.log("orderInfo===",orderInfo)
|
||||
console.log("goodsList===",goodsList)
|
||||
goodsList.some((v,i)=>{
|
||||
console.log(v)
|
||||
if( orderInfo.status == 'done' && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' ){
|
||||
data = true
|
||||
console.log(data)
|
||||
return data
|
||||
}
|
||||
})
|
||||
console.log(data)
|
||||
return data
|
||||
}
|
||||
|
||||
}
|
||||
export function isTuiCai(item) {
|
||||
return item.status == 'return'
|
||||
return item.status == 'return' || item.status == 'part_refund'
|
||||
}
|
||||
export function isTui(item) {
|
||||
console.log(item)
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding' || item.status == 'part_refund'
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
}
|
||||
export function isGift(item) {
|
||||
return !isTui(item) && item.isGift == 1
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class WebsocketUtil {
|
|||
}
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
if (this.isOpen) {
|
||||
this.send('心跳检测','heartbeat');
|
||||
this.send(JSON.stringify({"type": "ping_interval"}));
|
||||
}
|
||||
}, this.time);
|
||||
}
|
||||
|
|
@ -68,7 +68,6 @@ class WebsocketUtil {
|
|||
if (this.socketTask && this.isOpen) {
|
||||
this.socketTask.send({
|
||||
data: data,
|
||||
type: type||'heartbeat',
|
||||
success: (res) => {
|
||||
// console.log('消息发送成功', res);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@
|
|||
const form = reactive({
|
||||
...$form
|
||||
})
|
||||
console.log(form)
|
||||
watch(()=>props.price,(newval)=>{
|
||||
console.log(newval);
|
||||
form.price=newval
|
||||
|
|
|
|||
|
|
@ -4,13 +4,8 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
$uploadFile
|
||||
} from '@/http/yskApi/file.js'
|
||||
import {
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { uploadFile } from '@/api/index.js'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
|
@ -49,7 +44,7 @@
|
|||
// #ifndef H5
|
||||
file= par
|
||||
// #endif
|
||||
return $uploadFile(file)
|
||||
return uploadFile(file)
|
||||
}
|
||||
|
||||
function afterRead(e) {
|
||||
|
|
@ -62,7 +57,7 @@
|
|||
console.log(res);
|
||||
images.value.push({
|
||||
url: e.file[i].url,
|
||||
serveUrl: res.data[0]
|
||||
serveUrl: res
|
||||
})
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
|
|
@ -82,7 +77,7 @@
|
|||
console.log(res);
|
||||
images.value.push({
|
||||
url: e.file.url,
|
||||
serveUrl: res.data[0]
|
||||
serveUrl: res
|
||||
})
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
|
|
|
|||
|
|
@ -47,20 +47,10 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$uploadFile
|
||||
} from '@/http/yskApi/file.js'
|
||||
// import { consumableBreakage , productBreakage } from '@/http/yskApi/breakage.js'
|
||||
import {
|
||||
tbConsInfoFlowfrmLoss
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import { uploadFile } from '@/api/index.js'
|
||||
import { stockReportDamage } from '@/api/cons.js';
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
|
|
@ -156,9 +146,9 @@
|
|||
success: (res) => {
|
||||
let file = res.tempFiles[0];
|
||||
console.log(res)
|
||||
$uploadFile(file).then(res => {
|
||||
uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
vdata.imgUrlList.push(res.data[0])
|
||||
vdata.imgUrlList.push(res)
|
||||
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
|
|
@ -184,11 +174,10 @@
|
|||
function affirm() {
|
||||
let params = {
|
||||
coverImg: vdata.imgUrlList,
|
||||
consId: consId.value,
|
||||
amount: vdata.stockNumber,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
conId: consId.value,
|
||||
number: vdata.stockNumber,
|
||||
}
|
||||
tbConsInfoFlowfrmLoss(params).then((res) => {
|
||||
stockReportDamage(params).then((res) => {
|
||||
show.value = false;
|
||||
vdata.imgUrlList = [];
|
||||
vdata.stockNumber = 1;
|
||||
|
|
|
|||
|
|
@ -27,20 +27,12 @@
|
|||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<view style="color: #333333;">
|
||||
{{item.conUnit}}
|
||||
</view>
|
||||
<view>
|
||||
耗材单位
|
||||
</view>
|
||||
<view style="color: #333333;"> {{item.conUnit}} </view>
|
||||
<view> 耗材单位 </view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="color: #318AFE;">
|
||||
{{item.stockNumber}}
|
||||
</view>
|
||||
<view>
|
||||
剩余库存
|
||||
</view>
|
||||
<view style="color: #318AFE;"> {{item.stockNumber}} </view>
|
||||
<view> 剩余库存 </view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
|
|
@ -89,26 +81,13 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import myActionSheet from './components/my-action-sheet';
|
||||
import myReportDamage from './components/my-reportDamage';
|
||||
import color from '@/commons/color.js';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
viewConInfoFlowget,
|
||||
tbConsType,
|
||||
tbConsTypeList
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
import { getConsPage,getConsGrpupList } from '@/api/cons.js';
|
||||
|
||||
let reportDamage = ref(null)
|
||||
|
|
@ -193,12 +172,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 报损确认
|
||||
*/
|
||||
function affirm() {
|
||||
uni.showToast({
|
||||
title:'操作成功',
|
||||
icon:'none'
|
||||
})
|
||||
getList()
|
||||
// 获取分类列表
|
||||
gettbConsTypeList()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
ref="uFormRef"
|
||||
>
|
||||
<view class="card">
|
||||
|
||||
<up-form-item label="挂账人" prop="debtor" borderBottom="true" >
|
||||
<up-input v-model="pageData.formData.debtor" placeholder="请输入挂账人" border="none" ></up-input>
|
||||
</up-form-item>
|
||||
|
|
@ -57,11 +56,12 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { addCreditBuyer, editCreditBuyer } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { addCreditBuyer,editCreditBuyer } from '@/api/buyer.js';
|
||||
|
||||
const pageData = reactive({
|
||||
id: null,
|
||||
title: "",
|
||||
|
|
@ -195,6 +195,8 @@
|
|||
background: #318AFE;
|
||||
}
|
||||
.cancel{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@
|
|||
<script setup>
|
||||
import { reactive,ref } from 'vue';
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { creditRePayment, creditPayment } from '@/http/yskApi/credit.js'
|
||||
import { getCreditBuyerPage,creditBuyerRepayment,creditBuyerOrderPay } from '@/api/buyer.js';
|
||||
|
||||
const props=defineProps({
|
||||
show:{
|
||||
type:Boolean,
|
||||
|
|
@ -156,7 +157,7 @@
|
|||
...pageData.formData
|
||||
}
|
||||
if ( !pageData.formData.orderId ) {
|
||||
creditRePayment(params).then((res) => {
|
||||
creditBuyerRepayment(params).then((res) => {
|
||||
console.log(res.repaymentCount > 0)
|
||||
if (res.repaymentCount > 0) {
|
||||
uni.$u.toast('还款成功')
|
||||
|
|
@ -173,7 +174,7 @@
|
|||
|
||||
})
|
||||
} else {
|
||||
creditPayment(params).then((res) => {
|
||||
creditBuyerOrderPay(params).then((res) => {
|
||||
if (!res.repaymentMsg) {
|
||||
uni.$u.toast('付款成功')
|
||||
emits('affirm')
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@
|
|||
<view class="shade" v-show="pageData.showStatus" @tap="pageData.showStatus=false"></view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, computed, getCurrentInstance } from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myRepayment from './components/my-repayment';
|
||||
import datePickerview from './components/my-date-pickerview.vue'
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref, computed, getCurrentInstance } from 'vue';
|
||||
import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/api/buyer.js';
|
||||
const pageData = reactive({
|
||||
showStatus: false,
|
||||
statusList:[
|
||||
|
|
@ -173,8 +173,8 @@
|
|||
params.endDate = endDate.substring(0, 10);
|
||||
}
|
||||
creditBuyerOrderList(params).then(res => {
|
||||
pageData.list = [...pageData.list,...res.content]
|
||||
pageData.totalElements = res.totalElements
|
||||
pageData.list = [...pageData.list,...res.records]
|
||||
pageData.totalElements = res.totalRow
|
||||
})
|
||||
creditBuyerOrderSummary(params).then(res => {
|
||||
pageData.payCountList[0].amount = res.payAmountTotal
|
||||
|
|
@ -186,7 +186,6 @@
|
|||
}
|
||||
function changeTime(e) {
|
||||
pageData.selected = e
|
||||
console.log(e)
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
} else {
|
||||
|
|
@ -198,9 +197,9 @@
|
|||
function datePickerConfirm(e) {
|
||||
pageData.start = e.start
|
||||
pageData.end = e.end
|
||||
pageData.query.page = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
// gettableData() day如日期不能是1 7 30 就回报错
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -211,6 +210,8 @@
|
|||
pageData.showStatus = false
|
||||
pageData.statusTitle = item.label
|
||||
pageData.query.status = item.value
|
||||
pageData.query.page = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
}
|
||||
let repaymentOpen = (item) => {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@
|
|||
<text>{{pageData.title}}</text>
|
||||
<up-icon name="arrow-down-fill" size="12" style="margin-left: 12rpx;"></up-icon>
|
||||
</view>
|
||||
<!-- <view class="input">
|
||||
<input v-model="pageData.query.keywords" @input="inputEvent" type="text" placeholder="搜索挂账人或者手机号" />
|
||||
</view> -->
|
||||
<view class="input">
|
||||
<up-input
|
||||
shape='circle'
|
||||
|
|
@ -82,25 +79,15 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import { onShow, onReachBottom } from '@dcloudio/uni-app'
|
||||
|
||||
import myRepayment from './components/my-repayment';
|
||||
import color from '@/commons/color.js';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
getCreditBuyerList,
|
||||
editCreditBuyer,
|
||||
delCreditBuyer
|
||||
} from '@/http/yskApi/credit.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import { getCreditBuyerPage,editCreditBuyer,delCreditBuyer } from '@/api/buyer.js';
|
||||
|
||||
let pageData = reactive({
|
||||
showStatus: false,
|
||||
|
|
@ -141,15 +128,14 @@
|
|||
* 获取挂账人列表
|
||||
*/
|
||||
async function getList() {
|
||||
getCreditBuyerList({
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
repaymentStatus: pageData.query.repaymentStatus,
|
||||
getCreditBuyerPage({
|
||||
keywords: pageData.query.keywords,
|
||||
repaymentStatus: pageData.query.repaymentStatus,
|
||||
size: pageData.query.size,
|
||||
page: pageData.query.page
|
||||
}).then(res => {
|
||||
pageData.list = res.content
|
||||
pageData.totalElements = res.totalElements
|
||||
pageData.list = res.records
|
||||
pageData.totalElements = res.totalRow
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -294,6 +280,7 @@
|
|||
background-color: #fff;
|
||||
>view{
|
||||
margin-bottom: 16rpx;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
}
|
||||
.debtor{
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@
|
|||
|
||||
</template>
|
||||
<script setup>
|
||||
import { creditRePaymentRecord } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
|
||||
import { creditRePaymentRecord } from '@/api/buyer.js';
|
||||
const pageData = reactive({
|
||||
query: {
|
||||
page: 1,
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
orderId: null,
|
||||
paymentMethod: ''
|
||||
},
|
||||
totalElements: 0,
|
||||
list: []
|
||||
})
|
||||
|
||||
|
|
@ -51,7 +53,14 @@
|
|||
}
|
||||
getList()
|
||||
})
|
||||
|
||||
// 监听,触底事件。 查询下一页
|
||||
onReachBottom(() => {
|
||||
console.log(pageData.query.page)
|
||||
if( pageData.query.page * pageData.query.size < pageData.totalElements) {
|
||||
pageData.query.page++
|
||||
getList();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 获取还款记录列表
|
||||
*/
|
||||
|
|
@ -66,7 +75,8 @@
|
|||
params.orderId = pageData.query.orderId
|
||||
}
|
||||
creditRePaymentRecord(params).then(res => {
|
||||
pageData.list = res.content
|
||||
pageData.list = [...pageData.list,...res.records]
|
||||
pageData.totalElements = res.totalRow
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +85,8 @@
|
|||
*/
|
||||
function inputEvent(d) {
|
||||
pageData.query.paymentMethod = pageData.query.paymentMethod.replace(/\s*/g, "");
|
||||
console.log(pageData.query)
|
||||
pageData.query.size = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
bindGoodsList: [],
|
||||
goodsList: [],
|
||||
query: {
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 999,
|
||||
categoryId: '',
|
||||
name: '',
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@
|
|||
const res = await getProdGroupPage(pageData.query)
|
||||
pageData.list = res.records
|
||||
pageData.totalElements = res.totalRow
|
||||
if(res.records.length <= 0&&res.totalPage>1) {
|
||||
pageData.query.page = res.totalPage
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -231,7 +235,9 @@
|
|||
if (res.confirm) {
|
||||
delProdGroup(pageData.list[index].id).then(res => {
|
||||
infoBox.showToast('删除成功')
|
||||
getList()
|
||||
setTimeout(()=>{
|
||||
getList()
|
||||
},1500)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
:list="pageData.brandList"></picker-item>
|
||||
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
|
||||
:list="pageData.receiptsList"></picker-item>
|
||||
<picker-item title="类型" required v-model="form.connectionType" :modelValue="form.connectionType"
|
||||
:list="pageData.connectionTypeList"></picker-item>
|
||||
<view class="u-p-b-14 u-m-b-24 border-bottom">
|
||||
<view class="title"><span style="color: red;">*</span>打印机名称</view>
|
||||
<view class="">
|
||||
|
|
@ -122,18 +124,18 @@
|
|||
import go from '@/commons/utils/go.js';
|
||||
import pickerItem from './components/picker-item.vue';
|
||||
import myRadioGroup from './components/my-radio-group.vue';
|
||||
import * as Api from '@/http/yskApi/devices.js'
|
||||
|
||||
import { devices, models, subTypes, brand, receipts } from '@/pagePrinter/devices.js'
|
||||
import { devices, subTypes, brand, receipts,connectionType } from '@/pagePrinter/devices.js'
|
||||
import { getPrinterDetail, addPrinter, updatePrinter } from '@/api/printer.js'
|
||||
import { categoryPage } from '@/api/cateGory.js'
|
||||
|
||||
const pageData = reactive({
|
||||
brandList: brand, // 打印机品牌列表
|
||||
receiptsList: receipts, // 小票
|
||||
connectionTypeList: connectionType, // 类型
|
||||
deciveSizeList: [ // 小票尺寸
|
||||
{ label: '58mm', value: '58mm' },
|
||||
{ label: '80mm', value: '58mm' },
|
||||
{ label: '80mm', value: '80mm' },
|
||||
],
|
||||
classifyPrintList: [ // 分类打印
|
||||
{ label: '打印所有', value: '0' },
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
<template>
|
||||
<view class="u-p-b-24 u-m-b-24 border-bottom">
|
||||
<view class="title font-bold"> <text v-if="required" style="color: red;">*</text>{{title}}</view>
|
||||
<!-- <up-popup customStyle="overflow: hidden;" @change="change" :value="value" :range="list" range-key="name" round="20" mode="bottom">
|
||||
<view class="u-m-t-16 u-flex u-row-between ">
|
||||
<view class="color-333" v-if="selText">{{selText}}</view>
|
||||
<view class="color-999" v-else>请选择</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</up-popup> -->
|
||||
<picker @change="change" range-key="name" :value="value" :range="list">
|
||||
<view class="u-m-t-16 u-flex u-row-between ">
|
||||
<view class="color-333" v-if="selText">{{selText}}</view>
|
||||
|
|
@ -19,11 +12,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
const props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
|
|
|
|||
|
|
@ -1,63 +1,76 @@
|
|||
export const brand = [{
|
||||
value: 'yxyPrinter',
|
||||
value: '云想印',
|
||||
name: '云想印'
|
||||
},
|
||||
{
|
||||
value: 'fePrinter',
|
||||
value: '飞鹅',
|
||||
name: '飞鹅'
|
||||
}
|
||||
]
|
||||
export const receipts = [{
|
||||
value: 'label',
|
||||
value: '标签',
|
||||
name: '标签'
|
||||
},
|
||||
{
|
||||
value: 'kitchen',
|
||||
value: '出品',
|
||||
name: '出品'
|
||||
},
|
||||
{
|
||||
value: 'cash',
|
||||
value: '小票',
|
||||
name: '小票'
|
||||
}
|
||||
]
|
||||
export const devices = [{
|
||||
value: 'printer',
|
||||
value: '本地',
|
||||
name: '本地'
|
||||
},
|
||||
{
|
||||
value: 'yxyPrinter',
|
||||
value: '云想印',
|
||||
name: '云想印'
|
||||
},
|
||||
{
|
||||
value: 'fePrinter',
|
||||
value: '飞鹅',
|
||||
name: '飞鹅'
|
||||
}
|
||||
]
|
||||
|
||||
export const models = [{
|
||||
value: 'normal',
|
||||
value: '普通出单',
|
||||
name: '普通出单'
|
||||
},
|
||||
{
|
||||
value: 'one',
|
||||
value: '一菜一品',
|
||||
name: '一菜一品'
|
||||
},
|
||||
{
|
||||
value: 'category',
|
||||
value: '分类出单',
|
||||
name: '分类出单'
|
||||
}
|
||||
]
|
||||
|
||||
export const subTypes = [{
|
||||
value: 'kitchen',
|
||||
value: '出品',
|
||||
name: '出品'
|
||||
},
|
||||
{
|
||||
value: 'cash',
|
||||
value: '小票',
|
||||
name: '小票'
|
||||
},
|
||||
{
|
||||
value: 'label',
|
||||
value: '标签',
|
||||
name: '标签'
|
||||
}
|
||||
]
|
||||
export const connectionType = [{
|
||||
value: 'USB',
|
||||
name: 'USB'
|
||||
},
|
||||
{
|
||||
value: '蓝牙',
|
||||
name: '蓝牙'
|
||||
},
|
||||
{
|
||||
value: '网络',
|
||||
name: '网络'
|
||||
}
|
||||
]
|
||||
|
|
@ -30,26 +30,27 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view class="u-flex u-col-center">
|
||||
<image class="icon" src="/pagePrinter/static/icon/icon-type.svg" mode=""></image>
|
||||
<view class="color-666 u-m-l-10">类型</view>
|
||||
<image class="icon" src="/pagePrinter/static/icon/icon-category.svg" mode=""></image>
|
||||
<view class="color-666 u-m-l-10">品牌</view>
|
||||
</view>
|
||||
<view>
|
||||
{{subTypesName(data.subType)}}
|
||||
{{data.contentType}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
<view class="u-flex u-col-center">
|
||||
<image class="icon" src="/pagePrinter/static/icon/icon-category.svg" mode=""></image>
|
||||
<view class="color-666 u-m-l-10">分类</view>
|
||||
<image class="icon" src="/pagePrinter/static/icon/icon-type.svg" mode=""></image>
|
||||
<view class="color-666 u-m-l-10">类型</view>
|
||||
</view>
|
||||
<view>
|
||||
{{devicesName(data.contentType)}}
|
||||
{{data.connectionType}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32 u-flex u-row-right gap-20">
|
||||
<my-button v-if="data.connectionType == 'network'" shape="circle" :width="140" :height="56"
|
||||
<my-button shape="circle" :width="140" :height="56"
|
||||
type="cancel" @tap="delTableHandleEvent()" plain>删除</my-button>
|
||||
<my-button v-if="data.connectionType == 'network'" shape="circle" @click="toUrl" :width="140"
|
||||
<my-button shape="circle" @click="toUrl" :width="140"
|
||||
:height="56" plain>编辑</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -75,7 +76,7 @@
|
|||
})
|
||||
const emit = defineEmits(['init'])
|
||||
const delModel=ref(null)
|
||||
|
||||
console.log(props.data)
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
|
|
@ -86,15 +87,16 @@
|
|||
}
|
||||
|
||||
function devicesName(value) {
|
||||
return devices.find(item => item.value == value).name
|
||||
console.log(devices.find(item => (item.value == value||item.name == value)))
|
||||
return devices.find(item => (item.value == value||item.name == value)).name
|
||||
}
|
||||
|
||||
function modelsName(value) {
|
||||
return models.find(item => item.value == value).name
|
||||
return models.find(item => (item.value == value||item.name == value)).name
|
||||
}
|
||||
|
||||
function subTypesName(value) {
|
||||
return subTypes.find(item => item.value == value).name
|
||||
return subTypes.find(item => (item.value == value||item.name == value)).name
|
||||
}
|
||||
|
||||
function timeFilter(s) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<view class="u-m-b-32" v-for="(item,index) in list" :key="index">
|
||||
<view>{{item.text}}:</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input type="number" v-model="item.value">
|
||||
<up-input type="digit" v-model="item.value">
|
||||
<template #suffix>
|
||||
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -16,11 +16,7 @@
|
|||
报损数量
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="form.stockNumber" type="number">
|
||||
<!-- <template #suffix>
|
||||
<view>{{data.unitName}}</view>
|
||||
</template> -->
|
||||
</up-input>
|
||||
<up-input v-model="form.number" type="number"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
|
|
@ -53,30 +49,15 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$frmLoss
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { productReportDamage } from '@/api/product.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
goods: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
|
@ -88,7 +69,7 @@
|
|||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
remark: '',
|
||||
stockNumber: 1,
|
||||
number: 1,
|
||||
coverImg: []
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
|
|
@ -96,6 +77,9 @@
|
|||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
form.remark = ''
|
||||
form.number = 1
|
||||
form.coverImg = []
|
||||
}
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
|
|
@ -111,18 +95,19 @@
|
|||
}
|
||||
|
||||
async function save() {
|
||||
if (form.stockNumber <= 0) {
|
||||
if (form.number <= 0) {
|
||||
return infoBox.showToast('请输入正确的报损数量')
|
||||
}
|
||||
if (!form.remark) {
|
||||
return infoBox.showToast('请输入备注')
|
||||
}
|
||||
console.log(form);
|
||||
const res= await $frmLoss({
|
||||
let par = {
|
||||
...form,
|
||||
productId:props.goods.id,
|
||||
coverImg:form.coverImg[0]?form.coverImg[0].serveUrl:''
|
||||
})
|
||||
imgUrls:form.coverImg[0]?form.coverImg[0].serveUrl:''
|
||||
}
|
||||
delete par.coverImg
|
||||
const res= await productReportDamage(par)
|
||||
infoBox.showToast('提交成功!')
|
||||
popShow.value=false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<template v-if="data.skuList.length>=2">
|
||||
<template v-if="data.skuList.length>=1">
|
||||
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top" :style="skuStyle">
|
||||
<view class="u-font-24 info-p-l u-m-t-6">规格:</view>
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
|
||||
|
|
|
|||
|
|
@ -137,6 +137,9 @@
|
|||
} from 'vue';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { productSaleDate } from '@/api/summary.js'
|
||||
|
||||
|
||||
const timeList = [{
|
||||
label: '今天',
|
||||
value: 'today'
|
||||
|
|
@ -240,10 +243,9 @@
|
|||
} else if (selected.value == 'custom') {
|
||||
day.value = 30
|
||||
}
|
||||
dateProduct({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productSaleDate({
|
||||
day: day.value,
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 5
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.content
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
import * as $fun from './util.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getShopTable, shopTableBind } from '@/api/table.js'
|
||||
import { getShopTable, shopTableBind, shopTableClear } from '@/api/table.js'
|
||||
import { getShopArea } from '@/api/area.js'
|
||||
|
||||
const statusList = objToArrary($status)
|
||||
|
|
@ -224,10 +224,8 @@
|
|||
content: '确定要清台:' + item.name + '?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
$table.update({
|
||||
...item,
|
||||
status: "idle",
|
||||
qrcode: item.tableId,
|
||||
shopTableClear({
|
||||
id: item.id,
|
||||
}).then(res => {
|
||||
infoBox.showToast('清台成功')
|
||||
pageData.query.page = 1
|
||||
|
|
@ -262,12 +260,11 @@
|
|||
*/
|
||||
function toPay(item) {
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: item.tableId,
|
||||
tableId: item.id,
|
||||
tableName: item.name,
|
||||
masterId: item.masterId,
|
||||
orderId: item.orderId,
|
||||
discount: 1,
|
||||
userId:item.userId
|
||||
userId: item.userId
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +288,10 @@
|
|||
"tableCode": params.code,
|
||||
"id": item.id,
|
||||
}).then(res => {
|
||||
getTable()
|
||||
infoBox.showToast('桌台绑定成功')
|
||||
setTimeout(()=>{
|
||||
getTable()
|
||||
},1500)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -314,6 +314,13 @@
|
|||
"navigationBarTitleText": "结账"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_CHOOSE_BUYER",
|
||||
"path": "choose-buyer/choose-buyer",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择挂账人"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_ORDER_TUIKUAN",
|
||||
"path": "tuikuan/tuikuan",
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
const areaId=area.list[area.defaultCateIndex].id||''
|
||||
let res = await getShopTable({...query,areaId,name:searchValue.value,status:'idle'})
|
||||
tables.list = res.records
|
||||
tables.selIndex = res.records.findIndex(v => v.tableId == option.tableId)
|
||||
tables.selIndex = res.records.findIndex(v => v.id == option.id)
|
||||
query.totalElements= res.totalRow;
|
||||
tables.hasAjax = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,11 +103,7 @@
|
|||
default: []
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const discounts = [95, 90, 85, 80]
|
||||
const causes = reactive([{
|
||||
name: '顾客投诉质量问题',
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="!pageData.shopInfo.isTableFee">
|
||||
<template v-if="!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id">
|
||||
<!-- 不免餐位费 -->
|
||||
<view class="block">
|
||||
<view class=" ">
|
||||
|
|
@ -297,7 +297,6 @@
|
|||
import oneRemark from './components/remark'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
|
|
@ -313,8 +312,8 @@
|
|||
selIndex: -1
|
||||
})
|
||||
const option = reactive({
|
||||
masterId: '',
|
||||
tableId: ""
|
||||
id: '',
|
||||
tableId: "",
|
||||
})
|
||||
/**
|
||||
* 用餐人数
|
||||
|
|
@ -362,12 +361,11 @@
|
|||
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
console.log(opt);
|
||||
if (opt.tableId) {
|
||||
userNumbers.list = new Array(opt.maxCapacity ? opt.maxCapacity * 1 : 100).fill(1).map((v, index) => {
|
||||
return (index + 1) + '人'
|
||||
})
|
||||
getTableInfo(opt.tableId)
|
||||
console.log("opt====",opt);
|
||||
if (opt.tableId||opt.tableCode) {
|
||||
pageData.table.id = opt.tableId
|
||||
pageData.table.tableCode = opt.tableCode
|
||||
getTableInfo(opt)
|
||||
}
|
||||
getTbShopInfo()
|
||||
init()
|
||||
|
|
@ -511,23 +509,26 @@
|
|||
break;
|
||||
case 'onboc_add':
|
||||
case 'add':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartItem = getNowCart(msg.data,$goods,pageData.user)
|
||||
cartControls(cartItem,'add')
|
||||
break;
|
||||
case 'onboc_edit':
|
||||
case 'edit':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartItem = getNowCart(msg.data,$goods,pageData.user)
|
||||
cartControls(cartItem,'edit')
|
||||
break;
|
||||
case 'onboc_del':
|
||||
case 'del':
|
||||
cartItem = getNowCart(msg.data,$originGoods,pageData.user)
|
||||
cartItem = getNowCart(msg.data,$goods,pageData.user)
|
||||
cartControls(cartItem,'del')
|
||||
break;
|
||||
case 'onboc_cleanup':
|
||||
case 'cleanup':
|
||||
goods.lis = []
|
||||
break;
|
||||
case 'product_update':
|
||||
init()
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -556,7 +557,6 @@
|
|||
let goodsRes = await getGoods()
|
||||
// await getCart()
|
||||
$goods = goodsRes.records
|
||||
console.log($seatFee);
|
||||
if (!$seatFee.totalNumber) {
|
||||
updateChoseCount()
|
||||
}
|
||||
|
|
@ -603,10 +603,16 @@
|
|||
/**
|
||||
* 获取桌台信息
|
||||
*/
|
||||
async function getTableInfo(id) {
|
||||
const res = await getShopTableDetail({id: id})
|
||||
pageData.table = res
|
||||
getHistoryOrderDetail(res.tableCode)
|
||||
async function getTableInfo(opt) {
|
||||
const res = await getShopTableDetail({id: opt.tableId,tableCode: opt.tableCode})
|
||||
Object.assign(pageData.table, res)
|
||||
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
|
||||
userNumbers.list = new Array(res.maxCapacity ? res.maxCapacity * 1 : 100).fill(1).map((v, index) => {
|
||||
return (index + 1) + '人'
|
||||
})
|
||||
}
|
||||
|
||||
getHistoryOrderDetail(opt.tableCode)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -797,15 +803,16 @@
|
|||
* 更新就餐人数
|
||||
*/
|
||||
async function updateChoseCount() {
|
||||
const maxCapacity = pageData.table.id ? (pageData.table.maxCapacity || 0) : 100
|
||||
if (pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
|
||||
const maxCapacity = pageData.table&&pageData.table.id ? (pageData.table.maxCapacity || 0) : 100
|
||||
if (pageData.table&&pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
|
||||
uni.showToast({
|
||||
title: '当前台桌最大人数为: ' + maxCapacity
|
||||
})
|
||||
userNumbers.defaultCateIndex = maxCapacity - 1
|
||||
return
|
||||
}
|
||||
if (!pageData.shopInfo.isTableFee && pageData.table.id) {
|
||||
console.log(pageData.table)
|
||||
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
|
||||
//不免餐位费
|
||||
|
||||
let seatFee = {
|
||||
|
|
@ -827,10 +834,6 @@
|
|||
userNumbers.defaultCateIndex = e.detail.value
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
|
@ -841,11 +844,6 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (data) => {
|
||||
|
|
@ -854,9 +852,6 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function changeGoodsSel(index) {
|
||||
goods.sel = index
|
||||
}
|
||||
|
|
@ -878,23 +873,24 @@
|
|||
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
|
||||
let par = {
|
||||
shopId: pageData.shopInfo.id, //店铺Id
|
||||
userId: pageData.user.userId, //用户Id
|
||||
userId: pageData.user.userId, //用户Id
|
||||
tableCode: pageData.table.tableCode, //台桌编码
|
||||
dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
remark: pageData.form.note, //备注
|
||||
seatNum: userNumbers.defaultCateIndex * 1 + 1, //用餐人数
|
||||
seatNum: 0, //用餐人数
|
||||
packFee: $packFee.value, //打包费
|
||||
originAmount: goodsPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
placeNum: placeNum, //当前订单下单次数
|
||||
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||
vipPrice: vipPrice, //是否使用会员价
|
||||
}
|
||||
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
|
||||
par.seatNum = userNumbers.defaultCateIndex * 1 + 1
|
||||
}
|
||||
if(pageData.shopInfo.registerType == 'after'&&pageData.orderInfo){
|
||||
par.orderId = pageData.orderInfo.id
|
||||
}
|
||||
|
||||
console.log(userNumbers.defaultCateIndex * 1 + 1)
|
||||
console.log(pageData.shopInfo.registerType)
|
||||
const res = await createOrder(par)
|
||||
uni.$emit('update:createOrderIndex')
|
||||
websocketUtil.send(JSON.stringify({
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
<!-- 占位 -->
|
||||
<view class="color-333 item border-top u-flex u-row-center u-row-between"
|
||||
v-for="(item,index) in data" :key="index">
|
||||
<view class="">
|
||||
<view class="u-line-1">{{item.name}}</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666 u-line-1">{{item.specInfo||''}}</view>
|
||||
<view>
|
||||
<view class="up-line-1" >{{item.name}}</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666 up-line-1">{{item.specInfo||''}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex" style="flex-shrink: 0;">
|
||||
<view class="font-bold red u-m-r-32">¥{{formatPrice(item.lowPrice*item.number) }}</view>
|
||||
<view class="u-flex" @tap="updateNumber(false,index,item)">
|
||||
<image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode="">
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</view>
|
||||
<view class="icon-car-box" @tap="toggleGoods">
|
||||
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
||||
<view class="dot">{{goodsNumber}}</view>
|
||||
<view class="dot" v-if="goodsNumber>0">{{goodsNumber}}</view>
|
||||
</view>
|
||||
<view class="price font-bold u-flex">
|
||||
<view>¥</view>
|
||||
|
|
@ -152,9 +152,9 @@
|
|||
if (props.data.length <= 0) {
|
||||
return infoBox.showToast('还没有选择商品')
|
||||
}
|
||||
const { name, maxCapacity, status, type } = props.table
|
||||
const { name, status, type } = props.table
|
||||
console.log(props.table)
|
||||
if (props.table.id == '') {
|
||||
if (props.table.id == ''&&props.table.tableCode == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
|
|
@ -163,8 +163,8 @@
|
|||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
type: type,
|
||||
tableId: props.table.id,
|
||||
tableCode: props.table.tableCode,
|
||||
name:name,
|
||||
maxCapacity:maxCapacity,
|
||||
status:status,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@
|
|||
arr.push(group)
|
||||
datas.selectNumber += ele.number
|
||||
})
|
||||
console.log(arrlength)
|
||||
console.log(datas.selectNumber)
|
||||
if (arrlength == datas.selectNumber) {
|
||||
emits('confirm', arr, datas.item)
|
||||
close()
|
||||
|
|
|
|||
|
|
@ -116,13 +116,6 @@
|
|||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
|
||||
import { computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue';
|
||||
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
$table,
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import util from './util.js';
|
||||
import color from '@/commons/color.js';
|
||||
import guigeModel from './components/guige'
|
||||
|
|
@ -130,8 +123,8 @@
|
|||
import weighItem from './components/weigh.vue'
|
||||
import listGoodsItem from './components/list-goods-item.vue'
|
||||
import mySurcharge from './components/surcharge'
|
||||
|
||||
import myCar from './components/car'
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
|
|
@ -149,7 +142,7 @@
|
|||
import { getProductList } from '@/api/product.js'
|
||||
import { categoryPage } from '@/api/cateGory.js'
|
||||
import { inject } from 'vue';
|
||||
|
||||
import { getShopInfo } from '@/api/shop.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
|
|
@ -194,8 +187,9 @@
|
|||
is_gift: 0
|
||||
},
|
||||
orderId: null,
|
||||
|
||||
|
||||
isCars: false,
|
||||
isGoodsAdd: true,
|
||||
goodsData: null,
|
||||
})
|
||||
const guigeModelData = reactive({
|
||||
title: '',
|
||||
|
|
@ -213,6 +207,7 @@
|
|||
|
||||
onLoad((opt) => {
|
||||
option = opt
|
||||
console.log("opt===",opt)
|
||||
Object.assign(data.table, opt)
|
||||
if (opt.useType) {
|
||||
uni.setStorageSync('useType', opt.useType)
|
||||
|
|
@ -224,6 +219,7 @@
|
|||
isCreateOrderToDetail.value = true
|
||||
}
|
||||
init()
|
||||
xiadanClick()
|
||||
})
|
||||
watch(() => data.table.id, (newval, oldval) => {
|
||||
if (option.type != 'add') {
|
||||
|
|
@ -249,6 +245,15 @@
|
|||
onUnmounted(() => {
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 判断是否允许下单
|
||||
*/
|
||||
let canXiadan = ref(false)
|
||||
async function xiadanClick() {
|
||||
canXiadan.value = await hasPermission('允许下单')
|
||||
}
|
||||
|
||||
let $originGoods = []
|
||||
let $category = []
|
||||
|
||||
|
|
@ -257,8 +262,8 @@
|
|||
if (option.type == 'add') {
|
||||
setTabBar($category, $originGoods, [])
|
||||
}
|
||||
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(uni.getStorageSync("shopInfo"))
|
||||
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType', useType)
|
||||
|
||||
// await getTableInfo()
|
||||
|
|
@ -276,14 +281,16 @@
|
|||
return isShow;
|
||||
});
|
||||
$originGoods = goods;
|
||||
|
||||
|
||||
if (option.type == 'add') {
|
||||
cars.length = 0
|
||||
initCart()
|
||||
setTabBar($category, goods, [])
|
||||
return
|
||||
}
|
||||
|
||||
setTabBar($category, goods, cars)
|
||||
|
||||
initCart()
|
||||
}
|
||||
|
||||
|
|
@ -294,6 +301,8 @@
|
|||
websocketUtil.onMessage(res => {
|
||||
let msg = JSON.parse(res);
|
||||
let cartItem;
|
||||
let cartArr = [];
|
||||
console.log(msg)
|
||||
if( msg.msg_id ){
|
||||
websocketUtil.send(JSON.stringify({
|
||||
type: 'receipt',
|
||||
|
|
@ -302,29 +311,42 @@
|
|||
}
|
||||
if( msg.status == 0 ){
|
||||
infoBox.showToast('添加失败')
|
||||
return false;
|
||||
data.isGoodsAdd = true;
|
||||
return;
|
||||
}
|
||||
if ( msg.data ) {
|
||||
cartArr = data.tabbar.reduce((prve,cur)=>{
|
||||
prve = [...prve,...cur.foods]
|
||||
return prve
|
||||
},[])
|
||||
}
|
||||
|
||||
switch (msg.operate_type) {
|
||||
case 'onboc_init':
|
||||
cars.length = 0
|
||||
data.isCars = true;
|
||||
console.log("购物车信息onboc_init===",msg)
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,$originGoods)
|
||||
cartItem = getNowCart(item,cartArr)
|
||||
cartControls(cartItem,'add')
|
||||
})
|
||||
uni.hideLoading()
|
||||
break;
|
||||
case 'onboc_add':
|
||||
case 'add':
|
||||
cartItem = getNowCart(msg.data,$originGoods)
|
||||
cartItem = getNowCart(msg.data,cartArr)
|
||||
cartControls(cartItem,'add')
|
||||
infoBox.showToast('添加成功')
|
||||
break;
|
||||
case 'onboc_edit':
|
||||
case 'edit':
|
||||
cartItem = getNowCart(msg.data,$originGoods)
|
||||
cartItem = getNowCart(msg.data,cartArr)
|
||||
cartControls(cartItem,'edit')
|
||||
infoBox.showToast('添加成功')
|
||||
break;
|
||||
case 'onboc_del':
|
||||
case 'del':
|
||||
cartItem = getNowCart(msg.data,$originGoods)
|
||||
cartItem = getNowCart(msg.data,cartArr)
|
||||
cartControls(cartItem,'del')
|
||||
break;
|
||||
case 'onboc_cleanup':
|
||||
|
|
@ -336,6 +358,13 @@
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'init':
|
||||
case 'rottable':
|
||||
initCart()
|
||||
break;
|
||||
case 'product_update':
|
||||
init()
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -351,6 +380,9 @@
|
|||
table_code: data.table.tableCode,
|
||||
}
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -358,6 +390,7 @@
|
|||
*/
|
||||
function editCart (par,operate_type) {
|
||||
console.log('购物车添加菜品',par)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let params = {
|
||||
...data.socketData,
|
||||
operate_type: operate_type,
|
||||
|
|
@ -369,6 +402,7 @@
|
|||
}
|
||||
Object.assign(params, par)
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -461,11 +495,24 @@
|
|||
return
|
||||
}
|
||||
console.log('---table:detail-----',item);
|
||||
console.log('---table_code-----',data.table.tableCode);
|
||||
console.log('---new_table_code-----',item.tableCode);
|
||||
let params = {
|
||||
...data.socketData,
|
||||
operate_type: 'rottable',
|
||||
table_code: data.table.tableCode,
|
||||
new_table_code: item.tableCode,
|
||||
}
|
||||
console.log(cars)
|
||||
|
||||
if (data.table.id || cars.length <= 0) {
|
||||
data.table = {
|
||||
...item
|
||||
}
|
||||
initCart()
|
||||
if( cars.length > 0){
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
}
|
||||
// initCart()
|
||||
return;
|
||||
}
|
||||
if (item.status == "unbind") {
|
||||
|
|
@ -475,7 +522,10 @@
|
|||
return infoBox.showToast('该台桌已在使用中')
|
||||
}
|
||||
data.table = item
|
||||
initCart()
|
||||
if( cars.length > 0){
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
}
|
||||
// initCart()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -492,6 +542,10 @@
|
|||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
if( !data.isCars ){
|
||||
return infoBox.showToast('购物车加载中请稍等...')
|
||||
}
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.type !== 'sku') {
|
||||
//单规格
|
||||
|
|
@ -525,6 +579,7 @@
|
|||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
setSearchGoods(searchGoodsIndex, number)
|
||||
} else {
|
||||
// 不影响之前的代码 称重suit单独处理
|
||||
|
|
@ -539,7 +594,7 @@
|
|||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
},'add')
|
||||
infoBox.showToast('添加成功')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
@ -554,6 +609,7 @@
|
|||
if( !data.table.tableCode ){
|
||||
data.table.tableCode = cartItem.table_code
|
||||
}
|
||||
data.isGoodsAdd = true;
|
||||
let cartIndex = 0;
|
||||
let product_id = cartItem.product_id
|
||||
let sku_id = cartItem.sku_id
|
||||
|
|
@ -565,28 +621,19 @@
|
|||
sku_id = item.sku_id
|
||||
}
|
||||
})
|
||||
|
||||
data.tabbar.map(tabbarItem=>{
|
||||
if(tabbarItem.foods.find(v => v.id == product_id)){
|
||||
$goods = !product_id ? undefined : tabbarItem.foods.find(v => v.id == product_id)
|
||||
$goods = product_id < 0 ? {} : tabbarItem.foods.find(v => v.id == product_id)
|
||||
}
|
||||
})
|
||||
console.log($goods)
|
||||
let $sku;
|
||||
if( $goods.type != 'package'){
|
||||
//临时菜没有skuList
|
||||
$sku = !product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == sku_id)
|
||||
} else {
|
||||
$sku = !product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == sku_id)
|
||||
}
|
||||
if( type == 'del' ) {
|
||||
cars.splice(cartIndex, 1)
|
||||
$goods.chooseNumber = 0
|
||||
if($goods)$goods.chooseNumber = 0;
|
||||
return;
|
||||
}
|
||||
if( type == 'add' ){
|
||||
cars.push(cartItem)
|
||||
$goods.chooseNumber = cartItem.number
|
||||
if($goods)$goods.chooseNumber = cartItem.number
|
||||
}
|
||||
if( type == 'edit' ){
|
||||
cars[cartIndex].number = cartItem.number
|
||||
|
|
@ -602,6 +649,7 @@
|
|||
*/
|
||||
async function carsNumberChange(e) {
|
||||
console.log("carsNumberChange===",e)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let $sku;
|
||||
let $goods;
|
||||
data.tabbar.map(tabbarItem=>{
|
||||
|
|
@ -626,6 +674,7 @@
|
|||
product_id: e.goods.product_id,
|
||||
sku_id: e.goods.sku_id
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -635,15 +684,47 @@
|
|||
*/
|
||||
async function taocanConfirm(d, item) {
|
||||
console.log(d)
|
||||
editCart({
|
||||
number: item.skuList[0].suitNum,
|
||||
product_id: item.id,
|
||||
sku_id: item.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(d),
|
||||
},'add')
|
||||
let carGoods = null;
|
||||
cars.some(item=>{
|
||||
if(item.product_id == data.goodsData.id){
|
||||
let arr = []
|
||||
JSON.parse(item.pro_group_info).some((v,i)=>{
|
||||
if( JSON.stringify(v.selectData) == JSON.stringify(d[i].selectData) ){
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
if( arr.length == d.length ) {
|
||||
carGoods = item
|
||||
return carGoods;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (carGoods) {
|
||||
//更新
|
||||
let newNumber = carGoods.number * 1 + 1
|
||||
editCart({
|
||||
id: carGoods.id,
|
||||
number: newNumber,
|
||||
product_id: carGoods.product_id,
|
||||
sku_id: carGoods.sku_id,
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
} else {
|
||||
//添加
|
||||
editCart({
|
||||
number: item.skuList[0].suitNum,
|
||||
product_id: item.id,
|
||||
sku_id: item.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(d),
|
||||
},'add')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
let selGoods = ref({});
|
||||
/**
|
||||
* 打开规格弹窗
|
||||
|
|
@ -656,10 +737,14 @@
|
|||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
if( !data.isCars ){
|
||||
return infoBox.showToast('购物车加载中请稍等...')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
console.log($goods)
|
||||
selGoods.value = $goods
|
||||
if ($goods.groupType == 1) {
|
||||
data.goodsData = $goods
|
||||
instance.ctx.$refs.taocanModelRef.open()
|
||||
} else {
|
||||
console.log($goods)
|
||||
|
|
@ -716,6 +801,7 @@
|
|||
*/
|
||||
async function guigeConfirm(sku, suitNum) {
|
||||
console.log(sku)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let goods = guigeModelData.chooseGoods.item
|
||||
let sku_id = sku.id
|
||||
let product_id = goods.id
|
||||
|
|
@ -732,7 +818,8 @@
|
|||
number: newNumber,
|
||||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
},'add')
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
} else {
|
||||
//添加
|
||||
editCart({
|
||||
|
|
@ -740,7 +827,7 @@
|
|||
product_id: product_id,
|
||||
sku_id: sku_id,
|
||||
},'add')
|
||||
infoBox.showToast('添加成功')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -868,13 +955,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
let canXiadan = ref(false)
|
||||
async function xiadanClick() {
|
||||
canXiadan.value = await hasPermission('允许下单')
|
||||
}
|
||||
// xiadanClick()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1037,9 +1118,14 @@
|
|||
|
||||
|
||||
|
||||
// 称重
|
||||
/**
|
||||
* 称重
|
||||
*/
|
||||
const refweighitem = ref(null)
|
||||
const tapweigh = (foodsindex, index) => {
|
||||
if( !data.isCars ){
|
||||
return infoBox.showToast('购物车加载中请稍等...')
|
||||
}
|
||||
const goods = data.tabbar[index].foods[foodsindex]
|
||||
refweighitem.value.open(foodsindex, index, goods)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ export function getNowCart(carItem,goodsList,user) {
|
|||
if(carItem.product_id == goodsItem.id){
|
||||
goodsItem.skuList.map(item=>{
|
||||
if(carItem.sku_id == item.id){
|
||||
console.log(item)
|
||||
carItem.lowPrice = item.salePrice
|
||||
carItem.lowMemberPrice = item.memberPrice
|
||||
carItem.specInfo = item.specInfo
|
||||
|
|
|
|||
|
|
@ -0,0 +1,182 @@
|
|||
<template>
|
||||
<view class="page-gray u-font-28">
|
||||
<view class="search bg-fff u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search" @clear="search"
|
||||
v-model="query.keywords">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list ">
|
||||
<view class="bg-fff u-row-between u-flex no-choose border-r-12" @tap="chooseUser">
|
||||
<view>不选择挂账人</view>
|
||||
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
|
||||
</view>
|
||||
<template v-if="list.length>0">
|
||||
<view class="u-m-t-32 bg-fff box bg-fff">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
|
||||
@tap="chooseUser(index,item)">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-m-t-12">挂账人:{{item.debtor}}</view>
|
||||
<view class=" u-font-24 u-m-t-12 u-flex">
|
||||
<view class=" u-flex">
|
||||
<text class="">挂账额度:</text>
|
||||
<text class="color-main">{{item.creditAmount}}</text>
|
||||
</view>
|
||||
<view class="u-m-l-30 u-flex">
|
||||
<text class="">账户余额:</text>
|
||||
<text class="color-main">{{item.accountBalance}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
|
||||
border-color="#d1d1d1"></my-radio>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<template v-if="hasAjax&&list.length<=0">
|
||||
<my-img-empty tips="未找到相关用户"></my-img-empty>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { reactive, onBeforeMount, ref } from 'vue';
|
||||
import { getCreditBuyerPage } from '@/api/buyer.js';
|
||||
|
||||
let nouser = ref(false)
|
||||
let timer = null
|
||||
onLoad(() => {
|
||||
getBuyer()
|
||||
})
|
||||
onBeforeMount(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
|
||||
const query = reactive({
|
||||
keywords: "",
|
||||
page: 1,
|
||||
size: 10,
|
||||
status: 1
|
||||
})
|
||||
const list = reactive([])
|
||||
let hasAjax = ref(false)
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
async function getBuyer() {
|
||||
const res = await getCreditBuyerPage(query)
|
||||
hasAjax.value = true
|
||||
list.length = res.records.length
|
||||
for (let i in res.records) {
|
||||
list[i] = {
|
||||
...res.records[i],
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
query.totalElements = res.totalRow
|
||||
console.log(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人选择
|
||||
* @param {Object} index
|
||||
* @param {Object} item
|
||||
*/
|
||||
function chooseUser(index, item) {
|
||||
if (index === undefined || item === undefined) {
|
||||
nouser.value = true
|
||||
return emitChooser({
|
||||
id: '',
|
||||
debtor: '',
|
||||
creditAmount: '0.00',
|
||||
accountBalance: '0.00'
|
||||
})
|
||||
} else {
|
||||
list[index].checked = true
|
||||
emitChooser(item)
|
||||
}
|
||||
}
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-buyer', data)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 100)
|
||||
}
|
||||
function pageChange(e) {
|
||||
query.page = e
|
||||
getBuyer()
|
||||
}
|
||||
|
||||
function search() {
|
||||
query.page = 1
|
||||
getBuyer()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.search {
|
||||
padding-right: 28rpx;
|
||||
|
||||
.icon-saoma {
|
||||
margin-left: 20rpx;
|
||||
width: 34rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
.no-choose {
|
||||
padding: 36rpx 30rpx 36rpx 24rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 32rpx 30rpx 78rpx 24rpx;
|
||||
|
||||
.item {
|
||||
padding: 24rpx 0;
|
||||
|
||||
.headimg {
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
font-size: 0;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
|
||||
.img {
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item:not(:first-child) {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
@ -4,13 +4,13 @@
|
|||
<text class="">桌号:</text>
|
||||
<text class="">{{orderInfo.tableName||""}}</text>
|
||||
</view>
|
||||
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName&&orderInfo.status=='unpaid'">
|
||||
<!-- <view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName&&orderInfo.status=='unpaid'">
|
||||
<view class="block" @tap="rotatingTables"
|
||||
style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<view>转桌/并桌</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class=" color-999 border-bottom u-p-b-24">
|
||||
<text>共</text>
|
||||
<text class="color-333 "> {{goodsNumber}}</text>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount*item.returnNum}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
|
|
@ -70,7 +70,6 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
{{isTui(item)}}
|
||||
<template v-if="isTui(item)">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
|
|
@ -79,6 +78,10 @@
|
|||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="user.isVip == 1">
|
||||
<view>¥{{item.num*item.memberPrice}}</view>
|
||||
<view class="line-th color-666 ">¥{{item.num*item.price}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
|
||||
<view>¥{{returnTotalMoney(item)}}</view>
|
||||
|
|
@ -96,7 +99,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<template v-if="canTuicai(orderInfo,item)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.returnNum*item.returnAmount<item.payAmount">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||
class="no-wrap">退菜</text></my-button>
|
||||
|
|
@ -134,10 +137,10 @@
|
|||
已优惠¥{{youhuiAllPrice}}
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <view>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -162,18 +165,25 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="canTuiKuan(orderInfo)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||
<my-button :width="168" :height="48" plain shape="circle" @tap="tuikuan(data,index)"><text
|
||||
class="no-wrap">全部退款</text> </my-button>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
|
||||
<view></view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.orderAmount }}</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.orderAmount.toFixed(2)}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.payAmount}}</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.payAmount.toFixed(2)}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -358,7 +368,20 @@
|
|||
function returnTotalMoney(item) {
|
||||
return (item.payAmount).toFixed(2)
|
||||
}
|
||||
|
||||
function returnCanTuiMoney(item) {
|
||||
// if (props.orderInfo.status == 'unpaid') {
|
||||
// return returnTotalMoney(item)
|
||||
// } else {
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
return item.canReturnAmount
|
||||
} else if (item.price != item.unitPrice) {
|
||||
return item.price*item.num
|
||||
} else {
|
||||
return item.payAmount
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
const canTuiKuanPrice = computed(() => {
|
||||
const goodsTotal = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
|
||||
|
|
@ -396,19 +419,7 @@
|
|||
return seatFee
|
||||
})
|
||||
|
||||
function returnCanTuiMoney(item) {
|
||||
if (props.orderInfo.status == 'unpaid') {
|
||||
return returnTotalMoney(item)
|
||||
} else {
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
return item.canReturnAmount
|
||||
} else if (item.price != item.unitPrice) {
|
||||
return item.price*item.num
|
||||
} else {
|
||||
return item.payAmount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
|
|
@ -424,10 +435,27 @@
|
|||
function tuikuan(item, index) {
|
||||
hasPermission('允许退款').then(res => {
|
||||
if (res) {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
payAmount: item.payAmount
|
||||
}, index)
|
||||
if (Array.isArray(item)) {
|
||||
let arr = [];
|
||||
console.log(item)
|
||||
item.map(v=>{
|
||||
v.info.map(obj=>{
|
||||
obj.number = 0
|
||||
obj.skuName = obj.skuName || ''
|
||||
obj.priceAmount = obj.priceAmount ? obj.priceAmount : (obj.num*obj.unitPrice).toFixed(2)
|
||||
obj.unitPrice = obj.unitPrice
|
||||
})
|
||||
|
||||
arr = [...arr,...v.info]
|
||||
})
|
||||
emits('tuikuan', arr)
|
||||
} else {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
payAmount: item.payAmount
|
||||
}, index)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -448,7 +476,6 @@
|
|||
if (props.orderInfo.discountAmount) {
|
||||
return props.orderInfo.discountAmount
|
||||
}
|
||||
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
|
||||
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
|
||||
})
|
||||
const goodsOriginAllPrice = computed(() => {
|
||||
|
|
@ -513,7 +540,7 @@
|
|||
* 已优惠金额
|
||||
*/
|
||||
const youhuiAllPrice = computed(() => {
|
||||
const n = props.orderInfo.orderAmount - props.orderInfo.payAmount + vipDiscountPrice.value * 1
|
||||
const n = props.orderInfo.originAmount - props.orderInfo.orderAmount + vipDiscountPrice.value * 1
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
})
|
||||
|
||||
|
|
@ -531,7 +558,6 @@
|
|||
})
|
||||
const allPrice = computed(() => {
|
||||
|
||||
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.reduce((a,
|
||||
b) => {
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@
|
|||
</template>
|
||||
<view class="u-flex u-m-t-24 u-row-between u-font-28">
|
||||
<view class="">
|
||||
<view class="font-bold ">{{user.amount}}</view>
|
||||
<view class="font-bold ">{{user.amount||0}}</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">余额</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="font-bold">{{user.accountPoints}}</view>
|
||||
<view class="font-bold">{{user.accountPoints||0}}</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">积分</view>
|
||||
</view>
|
||||
<view class="">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
<template v-if="orderDetail.info.useType=='take-out'||!orderDetail.info.tableCode||orderDetail.info.useType=='dine-in-before'">
|
||||
<template v-if="orderDetail.info.dineMode=='take-out'||!orderDetail.info.tableCode||pageData.shopInfo.registerType=='before'">
|
||||
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
|
||||
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
|
|
@ -41,6 +41,8 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
|
|
@ -48,19 +50,16 @@
|
|||
import stepVue from './components/step.vue';
|
||||
import extraVue from './components/extra.vue';
|
||||
import tuicaiVue from './components/tuicai.vue';
|
||||
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
import OrderDetail from './page.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById } from '@/api/order.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById,printOrder } from '@/api/order.js'
|
||||
import { shopStaffDetail } from '@/api/staff.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
|
||||
import { getShopInfo } from '@/api/shop.js'
|
||||
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
|
|
@ -82,9 +81,13 @@
|
|||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
const pageData = reactive({
|
||||
shopInfo: {},
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
console.log("opt===",options);
|
||||
getShopInfoData()
|
||||
})
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
|
|
@ -92,7 +95,14 @@
|
|||
getOrderDetail()
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
function getShopInfoData () {
|
||||
getShopInfo({id:uni.getStorageSync('shopInfo').id}).then(res=>{
|
||||
pageData.shopInfo = res;
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
|
|
@ -101,7 +111,7 @@
|
|||
let res = await getHistoryOrder({orderId: options.id})
|
||||
console.log(res)
|
||||
if(res.userId){
|
||||
shopUserDetail({id:res.userId}).then(res=>{
|
||||
shopUserDetail({userId:res.userId}).then(res=>{
|
||||
if(res){
|
||||
user.value = res
|
||||
}
|
||||
|
|
@ -115,7 +125,7 @@
|
|||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
console.log("goodsList===",orderDetail.goodsList);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +166,7 @@
|
|||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: '',
|
||||
skuName: '',
|
||||
priceAmount,
|
||||
price
|
||||
})
|
||||
|
|
@ -177,28 +187,24 @@
|
|||
getOrderDetail()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function printDishes() {
|
||||
try {
|
||||
const res = await Api.$printDishes({
|
||||
tableId: orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印订单
|
||||
*/
|
||||
function onPrintOrder() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
printDishes()
|
||||
try {
|
||||
const res = await printOrder({
|
||||
id: orderDetail.info.id
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -211,32 +217,22 @@
|
|||
return
|
||||
}
|
||||
console.log(goods,'debug');
|
||||
const {
|
||||
id,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
productSkuName,
|
||||
cartId,
|
||||
orderId,
|
||||
num,
|
||||
priceAmount,
|
||||
price,userCouponId
|
||||
} = goods
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
orderId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: productSkuName || '',
|
||||
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
|
||||
price,
|
||||
userCouponId:userCouponId?userCouponId:''
|
||||
})
|
||||
if (Array.isArray(goods)) {
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
goodsList:JSON.stringify(goods)
|
||||
|
||||
})
|
||||
} else {
|
||||
goods.number = 0
|
||||
goods.skuName = goods.skuName || ''
|
||||
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*goods.unitPrice).toFixed(2)
|
||||
goods.unitPrice = goods.unitPrice
|
||||
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
goodsList:JSON.stringify([goods])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -256,10 +252,10 @@
|
|||
clearEmit()
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
masterId:orderDetail.info.masterId,
|
||||
type: 'add',
|
||||
vipUserId:orderDetail.userId?orderDetail.userId:''
|
||||
vipUserId: orderDetail.info.userId?orderDetail.info.userId:''
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -272,8 +268,8 @@
|
|||
clearEmit()
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: options.tableId|| orderDetail.info.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
tableName: options.name || orderDetail.info.tableName,
|
||||
orderId: orderDetail.info.id,
|
||||
discount: 1,
|
||||
userId
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-right">
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
||||
<text class="font-bold u-font-32">{{data.originAmount}}</text>
|
||||
</view>
|
||||
<view class="u-flex u-row-right u-m-t-24">
|
||||
<view class="print" @click.stop="print(item)">重新打印</view>
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@
|
|||
import { reactive, ref, watch } from 'vue';
|
||||
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
|
||||
import LIST from '@/commons/class/list.js'
|
||||
import {$printOrder} from '@/http/yskApi/Instead.js'
|
||||
import filterVue from './compoents/filter.vue';
|
||||
import orderList from './compoents/order-list.vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
|
||||
import { getOrderList } from '@/api/order.js'
|
||||
import { getOrderList,printOrder } from '@/api/order.js'
|
||||
|
||||
const search = reactive({
|
||||
placeholder: '搜索单号/商品名称',
|
||||
|
|
@ -84,33 +83,25 @@
|
|||
* 是否打印该订单
|
||||
* @param {Object} e
|
||||
*/
|
||||
function onPrintOrder(e){
|
||||
function onPrintOrder(item){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印该订单',
|
||||
success(res) {
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
printOrder(e)
|
||||
try{
|
||||
const res= await printOrder({
|
||||
id :item.id
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印该订单
|
||||
* @param {Object} item
|
||||
*/
|
||||
async function printOrder(item){
|
||||
try{
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页加载
|
||||
* @param {Object} e
|
||||
|
|
|
|||
|
|
@ -99,7 +99,19 @@
|
|||
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
|
||||
</view>
|
||||
<view class="u-flex color-999 u-font-24">
|
||||
<view class="u-m-r-20" v-if="item.payType=='virtual'&&pageData.user.id"
|
||||
<view class="u-m-r-20" v-if="item.payType=='virtual'&&pageData.buyer.id"
|
||||
@click.stop="chooseBuyer">
|
||||
<view>
|
||||
<text>挂账人:</text>
|
||||
<text class="u-m-r-4">{{pageData.buyer.debtor}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>挂账额度:</text>
|
||||
<text>¥{{pageData.buyer.creditAmount||'0'}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-m-r-20" v-if="item.payType=='member-account'&&pageData.user.id"
|
||||
@click.stop="chooseUser">
|
||||
<view>
|
||||
<text>会员:</text>
|
||||
|
|
@ -228,7 +240,6 @@
|
|||
import { reactive, onMounted, watch, ref, onBeforeUnmount, computed } from 'vue';
|
||||
import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
|
|
@ -244,8 +255,9 @@
|
|||
import { getCouponList } from '@/api/coupon.js'
|
||||
import { getHistoryOrder } from '@/api/order.js'
|
||||
import { getPayTypeList } from '@/api/payType.js'
|
||||
import { cashPay,vipPay,getOrderPayUrl } from '@/api/pay.js'
|
||||
import { scanPay,microPay,cashPay,vipPay,creditPay,getOrderPayUrl } from '@/api/pay.js'
|
||||
import { shopUserDetail } from '@/api/shopUser.js'
|
||||
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/api/points.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
|
|
@ -265,7 +277,8 @@
|
|||
user: { //会员信息
|
||||
userId: null,
|
||||
amount: 0
|
||||
}
|
||||
},
|
||||
buyer: {}
|
||||
})
|
||||
const order = reactive({
|
||||
orderAmount: 0
|
||||
|
|
@ -279,7 +292,8 @@
|
|||
list: [],
|
||||
selIndex: 0
|
||||
},
|
||||
quan: []
|
||||
quan: [],
|
||||
seatNum: 0
|
||||
})
|
||||
//打折相关数据
|
||||
const discount = reactive({
|
||||
|
|
@ -305,6 +319,7 @@
|
|||
let payCodeUrl = ref('') //收款二维码地址
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChoosebuyer()
|
||||
watchChooseQuan()
|
||||
})
|
||||
onLoad(async (opt) => {
|
||||
|
|
@ -345,19 +360,20 @@
|
|||
setQuan([...fullReductionCoupon, ...productCoupon])
|
||||
|
||||
// 获取用户信息
|
||||
console.log(order.userId)
|
||||
console.log(!pageData.user.userId)
|
||||
if (order.userId&&!pageData.user.userId) {
|
||||
calcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
console.log("pageData.user===",pageData.user)
|
||||
if (order.userId||pageData.user.userId) {
|
||||
|
||||
shopUserDetail({
|
||||
userId: order.userId || pageData.user.userId
|
||||
}).then(res => {
|
||||
pageData.user = res
|
||||
getCalcUsablePoints()
|
||||
if (orderRes.pointsNum) {
|
||||
accountPoints.sel = true
|
||||
}
|
||||
})
|
||||
}
|
||||
pageData.seatNum = order.tableId!=null&&order.tableId!="undefined" ? order.seatNum : 0;
|
||||
}
|
||||
const coupAllPrice = computed(() => {
|
||||
const n = pays.quan.reduce((prve, cur) => {
|
||||
|
|
@ -383,13 +399,12 @@
|
|||
* 订单金额
|
||||
*/
|
||||
const originPrice = computed(() => {
|
||||
console.log(order)
|
||||
console.log(packAmount)
|
||||
console.log("order===",order)
|
||||
if(pageData.goodsList){
|
||||
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.price)
|
||||
}, 0)
|
||||
return (goodsPrice + order.seatNum + packAmount.value).toFixed(2)
|
||||
return (goodsPrice + (pageData.seatNum||0) + packAmount.value).toFixed(2)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -462,6 +477,16 @@
|
|||
console.log("accountPoints===",accountPoints)
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||
console.log("payPrice===",total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 积分使用前金额
|
||||
*/
|
||||
const orderAmount = computed(() => {
|
||||
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
|
||||
.value - fullCouponDiscountAmount.value
|
||||
console.log(total)
|
||||
return (total < 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
|
@ -473,12 +498,14 @@
|
|||
}
|
||||
})
|
||||
watch(() => pointCanDicountPrice.value, (newval) => {
|
||||
calcUsablePoints()
|
||||
if( pageData.user.id ){
|
||||
getCalcUsablePoints()
|
||||
}
|
||||
})
|
||||
watch(() => payPrice.value, (newval) => {
|
||||
getPayUrl()
|
||||
if (newval <= 0) {
|
||||
const arr = ['cash', 'virtual']
|
||||
const arr = ['cash', 'member-account']
|
||||
pays.payTypes.list.map(v => {
|
||||
if (arr.includes(v.payType)) {
|
||||
v.disabled = false
|
||||
|
|
@ -514,27 +541,37 @@
|
|||
}, 2000)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function getPayParam () {
|
||||
return {
|
||||
shopId: uni.getStorageSync("shopInfo").id,
|
||||
orderId: order.id,
|
||||
originAmount: originPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
orderAmount: payPrice.value, // 订单金额
|
||||
seatNum: pageData.seatNum, // 用餐人数
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
vipPrice: vipDiscount.value != 0 ? 1: 0, // 是否使用会员价
|
||||
pointsDiscountAmount: accountPoints.sel ? accountPoints.price : 0,
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺订单支付URL
|
||||
*/
|
||||
function getPayUrl() {
|
||||
console.log(vipDiscount.value)
|
||||
let par = {
|
||||
console.log(discount)
|
||||
console.log(getPayParam())
|
||||
let par = getPayParam()
|
||||
let params = {
|
||||
shopId: uni.getStorageSync("shopInfo").id,
|
||||
orderId: order.id,
|
||||
orderAmount: payPrice.value,
|
||||
seatNum: order.seatNum, // 用餐人数
|
||||
discountRatio: (discount.discount/100).toFixed(0), // 折扣比例
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
vipPrice: vipDiscount.value > 0 ? 1: 0, // 是否使用会员价
|
||||
...par
|
||||
}
|
||||
if( order.userId||pageData.user.userId ){
|
||||
par.userId = order.userId||pageData.user.userId
|
||||
params.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
getOrderPayUrl(par).then(res => {
|
||||
getOrderPayUrl(params).then(res => {
|
||||
payCodeUrl.value = res
|
||||
})
|
||||
}
|
||||
|
|
@ -545,10 +582,14 @@
|
|||
*/
|
||||
async function getPayType() {
|
||||
const payTypeList = await getPayTypeList()
|
||||
pays.payTypes.list = payTypeList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
disabled: false
|
||||
pays.payTypes.list = [];
|
||||
payTypeList.map(v => {
|
||||
if( v.payType != 'bank'){
|
||||
|
||||
pays.payTypes.list.push({
|
||||
...v,
|
||||
disabled: false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -558,13 +599,12 @@
|
|||
* @param {Object} arr
|
||||
*/
|
||||
function setQuan(arr) {
|
||||
console.log(arr);
|
||||
console.log("choose-quan===",arr)
|
||||
discount.discount = 100
|
||||
discount.value = 0
|
||||
discount.currentPrice = order.orderAmount
|
||||
const manjianCoup = arr.filter(v => v.type == 1 && v.number >= 1)
|
||||
let productCoup = arr.filter(v => v.type == 2)
|
||||
console.log(productCoup);
|
||||
//商品券分组
|
||||
let coupMap = {}
|
||||
for (let i in productCoup) {
|
||||
|
|
@ -575,7 +615,6 @@
|
|||
coupMap[coup.proId] = [coup]
|
||||
}
|
||||
}
|
||||
console.log(coupMap);
|
||||
for (let key in coupMap) {
|
||||
const arr = coupMap[key]
|
||||
for (let i in arr) {
|
||||
|
|
@ -594,9 +633,7 @@
|
|||
}
|
||||
}
|
||||
productCoup = productCoup.filter(v => v.number >= 1)
|
||||
console.log(productCoup);
|
||||
pays.quan = [...manjianCoup, ...productCoup]
|
||||
console.log(pays.quan);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -625,12 +662,18 @@
|
|||
function pointsConfirm(e) {
|
||||
accountPoints.num = e
|
||||
}
|
||||
async function calcUsablePoints(orderAmount) {
|
||||
|
||||
/**
|
||||
* 获取积分信息
|
||||
* @param {Object} orderAmount
|
||||
*/
|
||||
async function getCalcUsablePoints(orderAmount) {
|
||||
if (!order.userId&&!pageData.user.userId) {
|
||||
return
|
||||
}
|
||||
const res = await Api.$calcUsablePoints({
|
||||
userId: order.userId||pageData.user.userId,
|
||||
console.log("calcUsablePoints",pageData.user)
|
||||
const res = await calcUsablePoints({
|
||||
userId: pageData.user.id,
|
||||
orderAmount: orderAmount ? orderAmount : payPrice.value
|
||||
})
|
||||
accountPoints.calcRes = res
|
||||
|
|
@ -643,9 +686,9 @@
|
|||
accountPoints.price = 0
|
||||
return ''
|
||||
}
|
||||
const res = await Api.$calcDeDuctionPoints({
|
||||
userId: order.userId||pageData.user.userId,
|
||||
orderAmount: originPrice.value,
|
||||
const res = await calcDeductionAmount({
|
||||
userId: pageData.user.id,
|
||||
orderAmount: orderAmount.value,
|
||||
points: accountPoints.num
|
||||
})
|
||||
if (res) {
|
||||
|
|
@ -733,6 +776,25 @@
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择挂账人
|
||||
*/
|
||||
function chooseBuyer() {
|
||||
go.to('PAGES_CHOOSE_BUYER')
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新选择挂账人
|
||||
*/
|
||||
function watchChoosebuyer() {
|
||||
uni.$off('choose-buyer')
|
||||
uni.$on('choose-buyer', (data) => {
|
||||
console.log(data);
|
||||
pageData.buyer = data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改价格确认
|
||||
* @param {Object} form
|
||||
|
|
@ -768,9 +830,13 @@
|
|||
pays.payTypes.selIndex = i
|
||||
console.log(item.payType)
|
||||
console.log(pageData.user.id)
|
||||
if (item.payType == 'virtual' && !pageData.user.id) {
|
||||
if (item.payType == 'member-account' && !pageData.user.id) {
|
||||
chooseUser()
|
||||
}
|
||||
if (item.payType == 'virtual' && !pageData.buyer.id) {
|
||||
chooseBuyer()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -799,13 +865,16 @@
|
|||
function payOrderClick() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
console.log(payType);
|
||||
if (payType == 'scanCode' || payType == 'deposit' || payType == 'bank') {
|
||||
if (payType == 'scanCode' || payType == 'deposit') {
|
||||
return saomaPay(payType)
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
return cashConfirmShow()
|
||||
}
|
||||
if (payType == 'virtual' && pageData.user.amount * 1 < order.orderAmount * 1) {
|
||||
if (payType == 'virtual') {
|
||||
// return cashConfirmShow()
|
||||
}
|
||||
if (payType == 'member-account' && pageData.user.amount * 1 < payPrice.value * 1) {
|
||||
infoBox.showToast('余额不足')
|
||||
return
|
||||
}
|
||||
|
|
@ -826,55 +895,60 @@
|
|||
*/
|
||||
async function pay(par) {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
let pars = getPayParam()
|
||||
console.log(payType)
|
||||
console.log(discount)
|
||||
payStatus = 'paying'
|
||||
let params = {
|
||||
shopId: uni.getStorageSync("shopInfo").id,
|
||||
checkOrderPay: {
|
||||
orderId: order.id || order.orderId,
|
||||
seatNum: order.seatNum, // 用餐人数
|
||||
discountRatio: (discount.discount/100).toFixed(0), // 折扣比例
|
||||
discountAmount: discount.value, // 手动优惠金额
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value, // 满减金额
|
||||
orderAmount: payPrice.value, // 订单金额
|
||||
vipPrice: vipDiscount.value > 0 ? 1: 0, // 是否使用会员价
|
||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||
couponList: pays.quan.map(v => {
|
||||
return {
|
||||
userCouponId: v.id,
|
||||
num: v.number
|
||||
}
|
||||
}),
|
||||
...par
|
||||
...pars
|
||||
},
|
||||
|
||||
...par
|
||||
}
|
||||
if( order.userId||pageData.user.userId ){
|
||||
params.checkOrderPay.userId = order.userId||pageData.user.userId
|
||||
}
|
||||
if( payType == 'virtual' ){
|
||||
params.creditBuyerId = pageData.buyer.id
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(params)
|
||||
if (payType == 'scanCode' || payType == 'deposit' || payType == 'bank') {
|
||||
}
|
||||
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||
try {
|
||||
try {
|
||||
if (payType == 'scanCode') {
|
||||
await microPay(params)
|
||||
}
|
||||
if (payType == 'cash') {
|
||||
await cashPay(params)
|
||||
} catch (error) {
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (payType == 'virtual' && pageData.user.amount * 1 > order.orderAmount * 1) {
|
||||
params.payType = 'userPay'
|
||||
params.shopUserId = pageData.user.id
|
||||
try {
|
||||
await vipPay(params)
|
||||
} catch (error) {
|
||||
payStatus = '';
|
||||
return false;
|
||||
if (payType == 'virtual') {
|
||||
await creditPay(params)
|
||||
}
|
||||
if( payType == 'member-account' || payType == 'deposit' ) {
|
||||
if (pageData.user.amount * 1 >= payPrice.value * 1) {
|
||||
params.payType = 'userPay'
|
||||
params.shopUserId = pageData.user.id
|
||||
await vipPay(params)
|
||||
} else {
|
||||
infoBox.showToast('余额不足')
|
||||
return
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
payStatus = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@
|
|||
console.log(pageData.order);
|
||||
const res = await getFindCoupon({
|
||||
shopUserId: option.shopUserId,
|
||||
type: pageData.types.sel
|
||||
type: pageData.types.sel+1
|
||||
})
|
||||
let fullReductionCoupon = res.filter(v => v.type == 1)
|
||||
let productCoupon = res.filter(v => v.type == 2)
|
||||
|
|
@ -340,7 +340,7 @@
|
|||
*/
|
||||
function changeFullReductionCouponSel(item) {
|
||||
if (!item.use) {
|
||||
// return
|
||||
return
|
||||
}
|
||||
console.log(item);
|
||||
if (item.id == pageData.fullReductionCouponSel.id) {
|
||||
|
|
|
|||
|
|
@ -132,10 +132,11 @@ export function returnProCoupStartIndex(coupArr,index){
|
|||
}
|
||||
//返回商品数量从0到n每一个对应的价格对照表
|
||||
export function returnGoodsPayPriceMap(goodsArr){
|
||||
let goods_arr = []
|
||||
let goods_arr = [{}]
|
||||
Object.values(goodsArr).forEach(item=>{
|
||||
goods_arr = [...goods_arr,...item]
|
||||
})
|
||||
console.log(goods_arr)
|
||||
return goods_arr.reduce((prve,cur)=>{
|
||||
if(!prve.hasOwnProperty(cur.productId)){
|
||||
prve[cur.productId]=[]
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@
|
|||
v-for="(item,index) in orderDetail.goodsList" :key="index">
|
||||
<view>
|
||||
<view>{{item.productName}}</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">{{item.productSkuName||""}}</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">{{item.skuName||""}}</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">最多可退×{{item.num}}</view>
|
||||
</view>
|
||||
<template v-if="option.productId=='-999'">
|
||||
<template v-if="item.productId=='-999'">
|
||||
<view class="u-flex">
|
||||
<view class="color-red" >¥{{item.priceAmount}}</view>
|
||||
<view class="u-flex u-m-l-32 u-col-center">
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex">
|
||||
<view class="color-red" v-if="!option.userCouponId">¥{{item.priceAmount}}</view>
|
||||
<view class="color-red" v-if="!item.userCouponId">¥{{item.priceAmount}}</view>
|
||||
<view class="u-flex u-m-l-32 u-col-center">
|
||||
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
|
||||
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
|
||||
|
|
@ -86,31 +86,39 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import color from '@/commons/color.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
$returnOrder
|
||||
} from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { refundOrder } from '@/api/order.js'
|
||||
|
||||
let allTui = ref(false)
|
||||
let note = ref('')
|
||||
const tuikuan = reactive({
|
||||
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
||||
sel: -1
|
||||
})
|
||||
|
||||
|
||||
const option=reactive({
|
||||
productId:'-999'
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(JSON.parse(opt.goodsList));
|
||||
|
||||
orderDetail.goodsList = JSON.parse(opt.goodsList)
|
||||
option.productId = orderDetail.goodsList[0].productId
|
||||
option.orderId = orderDetail.goodsList[0].orderId
|
||||
if(option.productId=='-999'){
|
||||
allTui.value=true
|
||||
}
|
||||
})
|
||||
watch(() => allTui.value, (newval) => {
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = newval ? v.num : 0
|
||||
})
|
||||
})
|
||||
|
||||
function changeTuiKuanSel(i) {
|
||||
tuikuan.sel = i
|
||||
}
|
||||
|
|
@ -122,11 +130,6 @@
|
|||
}
|
||||
})
|
||||
|
||||
watch(() => allTui.value, (newval) => {
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = newval ? v.num : 0
|
||||
})
|
||||
})
|
||||
|
||||
const totalNumber = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
|
|
@ -147,7 +150,10 @@
|
|||
const tuikuanPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
const n=(cur.number/cur.num*100) * cur.priceAmount
|
||||
return prve + (n/100).toFixed(2)
|
||||
console.log(n)
|
||||
console.log((n/100).toFixed(2))
|
||||
console.log(parseFloat(prve) + parseFloat((n/100).toFixed(2)))
|
||||
return parseFloat(prve) + parseFloat((n/100).toFixed(2))
|
||||
}, 0)
|
||||
})
|
||||
|
||||
|
|
@ -171,7 +177,10 @@
|
|||
item.number = newval;
|
||||
allTui.value = totalNumber.value == tuikuanNumber.value ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 确认退款
|
||||
*/
|
||||
async function tuikuanConfirm() {
|
||||
const canTuikuan=await hasPermission('允许退款')
|
||||
if(!canTuikuan){
|
||||
|
|
@ -185,36 +194,27 @@
|
|||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
await $returnOrder({
|
||||
"orderId": option.orderId,
|
||||
"note":noteResult,
|
||||
"orderDetails":orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
let params = {
|
||||
orderId: option.orderId,
|
||||
refundAmount: orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + (cur.number * 1 * cur.unitPrice)
|
||||
}, 0),
|
||||
refundReason: noteResult,
|
||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
return {
|
||||
id:v.id,
|
||||
num:v.number*1
|
||||
returnAmount: v.number * 1 * v.unitPrice,
|
||||
num: v.number * 1
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
await refundOrder(params)
|
||||
infoBox.showToast('退款请求提交成功')
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},500)
|
||||
}
|
||||
const option=reactive({
|
||||
productId:'-999'
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(option,opt)
|
||||
if(opt.productId=='-999'){
|
||||
allTui.value=true
|
||||
}
|
||||
if (Array.isArray(opt)) {
|
||||
orderDetail.goodsList = opt
|
||||
} else {
|
||||
orderDetail.goodsList = [opt]
|
||||
}
|
||||
console.log(opt);
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
Loading…
Reference in New Issue