代码更新

This commit is contained in:
GaoHao 2025-03-10 09:14:57 +08:00
parent 4f65b08c06
commit 490c513f48
48 changed files with 1162 additions and 537 deletions

136
api/buyer.js Normal file
View File

@ -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
}
})
}

View File

@ -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
}
})
}

View File

@ -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
}
})
}

View File

@ -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 * @returns

59
api/points.js Normal file
View File

@ -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
}
})
}

View File

@ -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
}
})
}
// 商品分类---------------------------------------------------------------------------------------------------- // 商品分类----------------------------------------------------------------------------------------------------
/** /**
* 获取商品分类列表 * 获取商品分类列表

16
api/summary.js Normal file
View File

@ -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
}
})
}

View File

@ -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 * @returns

View File

@ -17,15 +17,34 @@ export function canTuicai(orderInfo, item) {
return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return' return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return'
} }
export function canTuiKuan(orderInfo, item) { export function canTuiKuan(orderInfo, item) {
return orderInfo.status == 'done' && item.status != 'return' && item.status != 'refund' && item.status != if( item ){
'refunding' 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) { export function isTuiCai(item) {
return item.status == 'return' return item.status == 'return' || item.status == 'part_refund'
} }
export function isTui(item) { export function isTui(item) {
console.log(item) return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding' || item.status == 'part_refund'
} }
export function isGift(item) { export function isGift(item) {
return !isTui(item) && item.isGift == 1 return !isTui(item) && item.isGift == 1

View File

@ -58,7 +58,7 @@ class WebsocketUtil {
} }
this.heartbeatInterval = setInterval(() => { this.heartbeatInterval = setInterval(() => {
if (this.isOpen) { if (this.isOpen) {
this.send('心跳检测','heartbeat'); this.send(JSON.stringify({"type": "ping_interval"}));
} }
}, this.time); }, this.time);
} }
@ -68,7 +68,6 @@ class WebsocketUtil {
if (this.socketTask && this.isOpen) { if (this.socketTask && this.isOpen) {
this.socketTask.send({ this.socketTask.send({
data: data, data: data,
type: type||'heartbeat',
success: (res) => { success: (res) => {
// console.log('消息发送成功', res); // console.log('消息发送成功', res);
}, },

View File

@ -102,6 +102,7 @@
const form = reactive({ const form = reactive({
...$form ...$form
}) })
console.log(form)
watch(()=>props.price,(newval)=>{ watch(()=>props.price,(newval)=>{
console.log(newval); console.log(newval);
form.price=newval form.price=newval

View File

@ -4,13 +4,8 @@
</template> </template>
<script setup> <script setup>
import { import { ref, watch } from 'vue';
$uploadFile import { uploadFile } from '@/api/index.js'
} from '@/http/yskApi/file.js'
import {
ref,
watch
} from 'vue';
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -49,7 +44,7 @@
// #ifndef H5 // #ifndef H5
file= par file= par
// #endif // #endif
return $uploadFile(file) return uploadFile(file)
} }
function afterRead(e) { function afterRead(e) {
@ -62,7 +57,7 @@
console.log(res); console.log(res);
images.value.push({ images.value.push({
url: e.file[i].url, url: e.file[i].url,
serveUrl: res.data[0] serveUrl: res
}) })
}).catch(res => { }).catch(res => {
console.log(res); console.log(res);
@ -82,7 +77,7 @@
console.log(res); console.log(res);
images.value.push({ images.value.push({
url: e.file.url, url: e.file.url,
serveUrl: res.data[0] serveUrl: res
}) })
}).catch(res => { }).catch(res => {
console.log(res); console.log(res);

View File

@ -47,20 +47,10 @@
</template> </template>
<script setup> <script setup>
import { import { ref, reactive, onMounted, watch } from 'vue';
computed, import { uploadFile } from '@/api/index.js'
ref, import { stockReportDamage } from '@/api/cons.js';
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';
const props = defineProps({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
@ -156,9 +146,9 @@
success: (res) => { success: (res) => {
let file = res.tempFiles[0]; let file = res.tempFiles[0];
console.log(res) console.log(res)
$uploadFile(file).then(res => { uploadFile(file).then(res => {
console.log(res); console.log(res);
vdata.imgUrlList.push(res.data[0]) vdata.imgUrlList.push(res)
}).catch(res => { }).catch(res => {
console.log(res); console.log(res);
@ -184,11 +174,10 @@
function affirm() { function affirm() {
let params = { let params = {
coverImg: vdata.imgUrlList, coverImg: vdata.imgUrlList,
consId: consId.value, conId: consId.value,
amount: vdata.stockNumber, number: vdata.stockNumber,
shopId: uni.getStorageSync("shopId"),
} }
tbConsInfoFlowfrmLoss(params).then((res) => { stockReportDamage(params).then((res) => {
show.value = false; show.value = false;
vdata.imgUrlList = []; vdata.imgUrlList = [];
vdata.stockNumber = 1; vdata.stockNumber = 1;

View File

@ -27,20 +27,12 @@
</view> </view>
<view> <view>
<view> <view>
<view style="color: #333333;"> <view style="color: #333333;"> {{item.conUnit}} </view>
{{item.conUnit}} <view> 耗材单位 </view>
</view>
<view>
耗材单位
</view>
</view> </view>
<view> <view>
<view style="color: #318AFE;"> <view style="color: #318AFE;"> {{item.stockNumber}} </view>
{{item.stockNumber}} <view> 剩余库存 </view>
</view>
<view>
剩余库存
</view>
</view> </view>
</view> </view>
<view> <view>
@ -89,26 +81,13 @@
</template> </template>
<script setup> <script setup>
import { onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue';
import myActionSheet from './components/my-action-sheet'; import myActionSheet from './components/my-action-sheet';
import myReportDamage from './components/my-reportDamage'; import myReportDamage from './components/my-reportDamage';
import color from '@/commons/color.js'; 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 go from '@/commons/utils/go.js';
import { import { hasPermission } from '@/commons/utils/hasPermission.js';
hasPermission
} from '@/commons/utils/hasPermission.js';
import {
viewConInfoFlowget,
tbConsType,
tbConsTypeList
} from '@/http/yskApi/requestAll.js';
import { getConsPage,getConsGrpupList } from '@/api/cons.js'; import { getConsPage,getConsGrpupList } from '@/api/cons.js';
let reportDamage = ref(null) let reportDamage = ref(null)
@ -193,12 +172,14 @@
} }
} }
/** /**
* 报损确认 * 报损确认
*/ */
function affirm() { function affirm() {
uni.showToast({
title:'操作成功',
icon:'none'
})
getList() getList()
// //
gettbConsTypeList() gettbConsTypeList()

View File

@ -9,7 +9,6 @@
ref="uFormRef" ref="uFormRef"
> >
<view class="card"> <view class="card">
<up-form-item label="挂账人" prop="debtor" borderBottom="true" > <up-form-item label="挂账人" prop="debtor" borderBottom="true" >
<up-input v-model="pageData.formData.debtor" placeholder="请输入挂账人" border="none" ></up-input> <up-input v-model="pageData.formData.debtor" placeholder="请输入挂账人" border="none" ></up-input>
</up-form-item> </up-form-item>
@ -57,11 +56,12 @@
</view> </view>
</template> </template>
<script setup> <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 { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; 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({ const pageData = reactive({
id: null, id: null,
title: "", title: "",
@ -195,6 +195,8 @@
background: #318AFE; background: #318AFE;
} }
.cancel{ .cancel{
height: 80rpx;
line-height: 80rpx;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
} }

View File

@ -72,7 +72,8 @@
<script setup> <script setup>
import { reactive,ref } from 'vue'; import { reactive,ref } from 'vue';
import { debounce } from '@/commons/utils/debounce.js' 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({ const props=defineProps({
show:{ show:{
type:Boolean, type:Boolean,
@ -156,7 +157,7 @@
...pageData.formData ...pageData.formData
} }
if ( !pageData.formData.orderId ) { if ( !pageData.formData.orderId ) {
creditRePayment(params).then((res) => { creditBuyerRepayment(params).then((res) => {
console.log(res.repaymentCount > 0) console.log(res.repaymentCount > 0)
if (res.repaymentCount > 0) { if (res.repaymentCount > 0) {
uni.$u.toast('还款成功') uni.$u.toast('还款成功')
@ -173,7 +174,7 @@
}) })
} else { } else {
creditPayment(params).then((res) => { creditBuyerOrderPay(params).then((res) => {
if (!res.repaymentMsg) { if (!res.repaymentMsg) {
uni.$u.toast('付款成功') uni.$u.toast('付款成功')
emits('affirm') emits('affirm')

View File

@ -61,13 +61,13 @@
<view class="shade" v-show="pageData.showStatus" @tap="pageData.showStatus=false"></view> <view class="shade" v-show="pageData.showStatus" @tap="pageData.showStatus=false"></view>
</template> </template>
<script setup> <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 go from '@/commons/utils/go.js';
import myRepayment from './components/my-repayment'; import myRepayment from './components/my-repayment';
import datePickerview from './components/my-date-pickerview.vue' import datePickerview from './components/my-date-pickerview.vue'
import dayjs from 'dayjs' // import dayjs from 'dayjs' //
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'; import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/api/buyer.js';
import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/http/yskApi/credit.js'
import { reactive, ref, computed, getCurrentInstance } from 'vue';
const pageData = reactive({ const pageData = reactive({
showStatus: false, showStatus: false,
statusList:[ statusList:[
@ -173,8 +173,8 @@
params.endDate = endDate.substring(0, 10); params.endDate = endDate.substring(0, 10);
} }
creditBuyerOrderList(params).then(res => { creditBuyerOrderList(params).then(res => {
pageData.list = [...pageData.list,...res.content] pageData.list = [...pageData.list,...res.records]
pageData.totalElements = res.totalElements pageData.totalElements = res.totalRow
}) })
creditBuyerOrderSummary(params).then(res => { creditBuyerOrderSummary(params).then(res => {
pageData.payCountList[0].amount = res.payAmountTotal pageData.payCountList[0].amount = res.payAmountTotal
@ -186,7 +186,6 @@
} }
function changeTime(e) { function changeTime(e) {
pageData.selected = e pageData.selected = e
console.log(e)
if (e == 'custom') { if (e == 'custom') {
currentInstance.ctx.$refs.datePicker.toggle() currentInstance.ctx.$refs.datePicker.toggle()
} else { } else {
@ -198,9 +197,9 @@
function datePickerConfirm(e) { function datePickerConfirm(e) {
pageData.start = e.start pageData.start = e.start
pageData.end = e.end pageData.end = e.end
pageData.query.page = 1;
pageData.list = [];
getList() getList()
// gettableData() day1 7 30
} }
/** /**
@ -211,6 +210,8 @@
pageData.showStatus = false pageData.showStatus = false
pageData.statusTitle = item.label pageData.statusTitle = item.label
pageData.query.status = item.value pageData.query.status = item.value
pageData.query.page = 1;
pageData.list = [];
getList() getList()
} }
let repaymentOpen = (item) => { let repaymentOpen = (item) => {

View File

@ -4,9 +4,6 @@
<text>{{pageData.title}}</text> <text>{{pageData.title}}</text>
<up-icon name="arrow-down-fill" size="12" style="margin-left: 12rpx;"></up-icon> <up-icon name="arrow-down-fill" size="12" style="margin-left: 12rpx;"></up-icon>
</view> </view>
<!-- <view class="input">
<input v-model="pageData.query.keywords" @input="inputEvent" type="text" placeholder="搜索挂账人或者手机号" />
</view> -->
<view class="input"> <view class="input">
<up-input <up-input
shape='circle' shape='circle'
@ -82,25 +79,15 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed } from 'vue';
import { onShow, onReachBottom } from '@dcloudio/uni-app'
import myRepayment from './components/my-repayment'; import myRepayment from './components/my-repayment';
import color from '@/commons/color.js'; 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 go from '@/commons/utils/go.js';
import { import { hasPermission } from '@/commons/utils/hasPermission.js';
hasPermission
} from '@/commons/utils/hasPermission.js'; import { getCreditBuyerPage,editCreditBuyer,delCreditBuyer } from '@/api/buyer.js';
import {
getCreditBuyerList,
editCreditBuyer,
delCreditBuyer
} from '@/http/yskApi/credit.js';
let pageData = reactive({ let pageData = reactive({
showStatus: false, showStatus: false,
@ -141,15 +128,14 @@
* 获取挂账人列表 * 获取挂账人列表
*/ */
async function getList() { async function getList() {
getCreditBuyerList({ getCreditBuyerPage({
shopId: uni.getStorageSync("shopId"),
repaymentStatus: pageData.query.repaymentStatus,
keywords: pageData.query.keywords, keywords: pageData.query.keywords,
repaymentStatus: pageData.query.repaymentStatus,
size: pageData.query.size, size: pageData.query.size,
page: pageData.query.page page: pageData.query.page
}).then(res => { }).then(res => {
pageData.list = res.content pageData.list = res.records
pageData.totalElements = res.totalElements pageData.totalElements = res.totalRow
}) })
} }
@ -294,6 +280,7 @@
background-color: #fff; background-color: #fff;
>view{ >view{
margin-bottom: 16rpx; margin-bottom: 16rpx;
margin-top: 16rpx;
} }
} }
.debtor{ .debtor{

View File

@ -27,9 +27,10 @@
</template> </template>
<script setup> <script setup>
import { creditRePaymentRecord } from '@/http/yskApi/credit.js'
import { reactive, ref } from 'vue'; 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({ const pageData = reactive({
query: { query: {
page: 1, page: 1,
@ -38,6 +39,7 @@
orderId: null, orderId: null,
paymentMethod: '' paymentMethod: ''
}, },
totalElements: 0,
list: [] list: []
}) })
@ -51,7 +53,14 @@
} }
getList() 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 params.orderId = pageData.query.orderId
} }
creditRePaymentRecord(params).then(res => { 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) { function inputEvent(d) {
pageData.query.paymentMethod = pageData.query.paymentMethod.replace(/\s*/g, ""); pageData.query.paymentMethod = pageData.query.paymentMethod.replace(/\s*/g, "");
console.log(pageData.query) pageData.query.size = 1;
pageData.list = [];
getList() getList()
} }
</script> </script>

View File

@ -93,7 +93,7 @@
bindGoodsList: [], bindGoodsList: [],
goodsList: [], goodsList: [],
query: { query: {
page: 0, page: 1,
size: 999, size: 999,
categoryId: '', categoryId: '',
name: '', name: '',

View File

@ -107,6 +107,10 @@
const res = await getProdGroupPage(pageData.query) const res = await getProdGroupPage(pageData.query)
pageData.list = res.records pageData.list = res.records
pageData.totalElements = res.totalRow 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) { if (res.confirm) {
delProdGroup(pageData.list[index].id).then(res => { delProdGroup(pageData.list[index].id).then(res => {
infoBox.showToast('删除成功') infoBox.showToast('删除成功')
getList() setTimeout(()=>{
getList()
},1500)
}) })
} }
}, },

View File

@ -6,6 +6,8 @@
:list="pageData.brandList"></picker-item> :list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType" <picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="pageData.receiptsList"></picker-item> :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="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机名称</view> <view class="title"><span style="color: red;">*</span>打印机名称</view>
<view class=""> <view class="">
@ -122,18 +124,18 @@
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue'; import pickerItem from './components/picker-item.vue';
import myRadioGroup from './components/my-radio-group.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 { getPrinterDetail, addPrinter, updatePrinter } from '@/api/printer.js'
import { categoryPage } from '@/api/cateGory.js' import { categoryPage } from '@/api/cateGory.js'
const pageData = reactive({ const pageData = reactive({
brandList: brand, // brandList: brand, //
receiptsList: receipts, // receiptsList: receipts, //
connectionTypeList: connectionType, //
deciveSizeList: [ // deciveSizeList: [ //
{ label: '58mm', value: '58mm' }, { label: '58mm', value: '58mm' },
{ label: '80mm', value: '58mm' }, { label: '80mm', value: '80mm' },
], ],
classifyPrintList: [ // classifyPrintList: [ //
{ label: '打印所有', value: '0' }, { label: '打印所有', value: '0' },

View File

@ -1,13 +1,6 @@
<template> <template>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <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> <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"> <picker @change="change" range-key="name" :value="value" :range="list">
<view class="u-m-t-16 u-flex u-row-between "> <view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view> <view class="color-333" v-if="selText">{{selText}}</view>
@ -19,11 +12,7 @@
</template> </template>
<script setup> <script setup>
import { import { computed, ref, watch } from 'vue';
computed,
ref,
watch
} from 'vue';
const props = defineProps({ const props = defineProps({
list: { list: {
type: Array, type: Array,

View File

@ -1,63 +1,76 @@
export const brand = [{ export const brand = [{
value: 'yxyPrinter', value: '云想印',
name: '云想印' name: '云想印'
}, },
{ {
value: 'fePrinter', value: '飞鹅',
name: '飞鹅' name: '飞鹅'
} }
] ]
export const receipts = [{ export const receipts = [{
value: 'label', value: '标签',
name: '标签' name: '标签'
}, },
{ {
value: 'kitchen', value: '出品',
name: '出品' name: '出品'
}, },
{ {
value: 'cash', value: '小票',
name: '小票' name: '小票'
} }
] ]
export const devices = [{ export const devices = [{
value: 'printer', value: '本地',
name: '本地' name: '本地'
}, },
{ {
value: 'yxyPrinter', value: '云想印',
name: '云想印' name: '云想印'
}, },
{ {
value: 'fePrinter', value: '飞鹅',
name: '飞鹅' name: '飞鹅'
} }
] ]
export const models = [{ export const models = [{
value: 'normal', value: '普通出单',
name: '普通出单' name: '普通出单'
}, },
{ {
value: 'one', value: '一菜一品',
name: '一菜一品' name: '一菜一品'
}, },
{ {
value: 'category', value: '分类出单',
name: '分类出单' name: '分类出单'
} }
] ]
export const subTypes = [{ export const subTypes = [{
value: 'kitchen', value: '出品',
name: '出品' name: '出品'
}, },
{ {
value: 'cash', value: '小票',
name: '小票' name: '小票'
}, },
{ {
value: 'label', value: '标签',
name: '标签' name: '标签'
} }
]
export const connectionType = [{
value: 'USB',
name: 'USB'
},
{
value: '蓝牙',
name: '蓝牙'
},
{
value: '网络',
name: '网络'
}
] ]

View File

@ -30,26 +30,27 @@
</view> </view>
<view class="u-flex u-row-between u-m-t-32"> <view class="u-flex u-row-between u-m-t-32">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
<image class="icon" src="/pagePrinter/static/icon/icon-type.svg" mode=""></image> <image class="icon" src="/pagePrinter/static/icon/icon-category.svg" mode=""></image>
<view class="color-666 u-m-l-10">类型</view> <view class="color-666 u-m-l-10">品牌</view>
</view> </view>
<view> <view>
{{subTypesName(data.subType)}} {{data.contentType}}
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-t-32"> <view class="u-flex u-row-between u-m-t-32">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
<image class="icon" src="/pagePrinter/static/icon/icon-category.svg" mode=""></image> <image class="icon" src="/pagePrinter/static/icon/icon-type.svg" mode=""></image>
<view class="color-666 u-m-l-10"></view> <view class="color-666 u-m-l-10"></view>
</view> </view>
<view> <view>
{{devicesName(data.contentType)}} {{data.connectionType}}
</view> </view>
</view> </view>
<view class="u-m-t-32 u-flex u-row-right gap-20"> <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> 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> :height="56" plain>编辑</my-button>
</view> </view>
</view> </view>
@ -75,7 +76,7 @@
}) })
const emit = defineEmits(['init']) const emit = defineEmits(['init'])
const delModel=ref(null) const delModel=ref(null)
console.log(props.data)
/** /**
* 编辑 * 编辑
*/ */
@ -86,15 +87,16 @@
} }
function devicesName(value) { 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) { 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) { 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) { function timeFilter(s) {

View File

@ -12,7 +12,7 @@
<view class="u-m-b-32" v-for="(item,index) in list" :key="index"> <view class="u-m-b-32" v-for="(item,index) in list" :key="index">
<view>{{item.text}}</view> <view>{{item.text}}</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-input type="number" v-model="item.value"> <up-input type="digit" v-model="item.value">
<template #suffix> <template #suffix>
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button> <up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
</template> </template>

View File

@ -16,11 +16,7 @@
报损数量 报损数量
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-input v-model="form.stockNumber" type="number"> <up-input v-model="form.number" type="number"></up-input>
<!-- <template #suffix>
<view>{{data.unitName}}</view>
</template> -->
</up-input>
</view> </view>
</view> </view>
<view class="u-m-b-32"> <view class="u-m-b-32">
@ -53,30 +49,15 @@
</template> </template>
<script setup> <script setup>
import { import { reactive, ref, watch } from 'vue';
reactive, import { productReportDamage } from '@/api/product.js'
ref,
watch,
onMounted
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
$frmLoss
} from '@/http/yskApi/goods.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
default: false default: false
}, },
category: {
type: Array,
default: () => []
},
goods: { goods: {
type: Object, type: Object,
default: () => { default: () => {
@ -88,7 +69,7 @@
const emits = defineEmits(['update:show', 'save']) const emits = defineEmits(['update:show', 'save'])
const form = reactive({ const form = reactive({
remark: '', remark: '',
stockNumber: 1, number: 1,
coverImg: [] coverImg: []
}) })
let popShow = ref(props.show) let popShow = ref(props.show)
@ -96,6 +77,9 @@
popShow.value = newval popShow.value = newval
if (newval) { if (newval) {
data.value = props.goods data.value = props.goods
form.remark = ''
form.number = 1
form.coverImg = []
} }
}) })
watch(() => popShow.value, (newval) => { watch(() => popShow.value, (newval) => {
@ -111,18 +95,19 @@
} }
async function save() { async function save() {
if (form.stockNumber <= 0) { if (form.number <= 0) {
return infoBox.showToast('请输入正确的报损数量') return infoBox.showToast('请输入正确的报损数量')
} }
if (!form.remark) { if (!form.remark) {
return infoBox.showToast('请输入备注') return infoBox.showToast('请输入备注')
} }
console.log(form); let par = {
const res= await $frmLoss({
...form, ...form,
productId:props.goods.id, 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('提交成功!') infoBox.showToast('提交成功!')
popShow.value=false popShow.value=false
} }

View File

@ -40,7 +40,7 @@
</view> </view>
</view> </view>
<view class="u-m-t-24"> <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-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="u-font-24 info-p-l u-m-t-6">规格</view>
<view class="skd" v-for="(item,index) in data.skuList" :key="index" <view class="skd" v-for="(item,index) in data.skuList" :key="index"

View File

@ -137,6 +137,9 @@
} from 'vue'; } from 'vue';
import dayjs from 'dayjs' // import dayjs from 'dayjs' //
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import { productSaleDate } from '@/api/summary.js'
const timeList = [{ const timeList = [{
label: '今天', label: '今天',
value: 'today' value: 'today'
@ -240,10 +243,9 @@
} else if (selected.value == 'custom') { } else if (selected.value == 'custom') {
day.value = 30 day.value = 30
} }
dateProduct({ productSaleDate({
shopId: uni.getStorageSync('shopId'),
day: day.value, day: day.value,
page: 0, page: 1,
size: 5 size: 5
}).then((res) => { }).then((res) => {
tableList.value = res.productList.content tableList.value = res.productList.content

View File

@ -95,7 +95,7 @@
import * as $fun from './util.js' import * as $fun from './util.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import { hasPermission } from '@/commons/utils/hasPermission.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' import { getShopArea } from '@/api/area.js'
const statusList = objToArrary($status) const statusList = objToArrary($status)
@ -224,10 +224,8 @@
content: '确定要清台:' + item.name + '', content: '确定要清台:' + item.name + '',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
$table.update({ shopTableClear({
...item, id: item.id,
status: "idle",
qrcode: item.tableId,
}).then(res => { }).then(res => {
infoBox.showToast('清台成功') infoBox.showToast('清台成功')
pageData.query.page = 1 pageData.query.page = 1
@ -262,12 +260,11 @@
*/ */
function toPay(item) { function toPay(item) {
go.to('PAGES_ORDER_PAY', { go.to('PAGES_ORDER_PAY', {
tableId: item.tableId, tableId: item.id,
tableName: item.name, tableName: item.name,
masterId: item.masterId,
orderId: item.orderId, orderId: item.orderId,
discount: 1, discount: 1,
userId:item.userId userId: item.userId
}) })
} }
@ -291,7 +288,10 @@
"tableCode": params.code, "tableCode": params.code,
"id": item.id, "id": item.id,
}).then(res => { }).then(res => {
getTable() infoBox.showToast('桌台绑定成功')
setTimeout(()=>{
getTable()
},1500)
}) })
} }
}); });

View File

@ -314,6 +314,13 @@
"navigationBarTitleText": "结账" "navigationBarTitleText": "结账"
} }
}, },
{
"pageId": "PAGES_CHOOSE_BUYER",
"path": "choose-buyer/choose-buyer",
"style": {
"navigationBarTitleText": "选择挂账人"
}
},
{ {
"pageId": "PAGES_ORDER_TUIKUAN", "pageId": "PAGES_ORDER_TUIKUAN",
"path": "tuikuan/tuikuan", "path": "tuikuan/tuikuan",

View File

@ -115,7 +115,7 @@
const areaId=area.list[area.defaultCateIndex].id||'' const areaId=area.list[area.defaultCateIndex].id||''
let res = await getShopTable({...query,areaId,name:searchValue.value,status:'idle'}) let res = await getShopTable({...query,areaId,name:searchValue.value,status:'idle'})
tables.list = res.records 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; query.totalElements= res.totalRow;
tables.hasAjax = true; tables.hasAjax = true;

View File

@ -103,11 +103,7 @@
default: [] default: []
} }
}) })
const discounts = [95, 90, 85, 80] const discounts = [95, 90, 85, 80]
const causes = reactive([{ const causes = reactive([{
name: '顾客投诉质量问题', name: '顾客投诉质量问题',

View File

@ -70,7 +70,7 @@
</view> </view>
</view> </view>
</template> </template>
<template v-if="!pageData.shopInfo.isTableFee"> <template v-if="!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id">
<!-- 不免餐位费 --> <!-- 不免餐位费 -->
<view class="block"> <view class="block">
<view class=" "> <view class=" ">
@ -297,7 +297,6 @@
import oneRemark from './components/remark' import oneRemark from './components/remark'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue' import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import * as Api from '@/http/yskApi/Instead.js'
import $storageManage from '@/commons/utils/storageManage.js' import $storageManage from '@/commons/utils/storageManage.js'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import { getNowCart } from '@/pagesCreateOrder/util.js' import { getNowCart } from '@/pagesCreateOrder/util.js'
@ -313,8 +312,8 @@
selIndex: -1 selIndex: -1
}) })
const option = reactive({ const option = reactive({
masterId: '', id: '',
tableId: "" tableId: "",
}) })
/** /**
* 用餐人数 * 用餐人数
@ -362,12 +361,11 @@
onLoad((opt) => { onLoad((opt) => {
Object.assign(option, opt) Object.assign(option, opt)
console.log(opt); console.log("opt====",opt);
if (opt.tableId) { if (opt.tableId||opt.tableCode) {
userNumbers.list = new Array(opt.maxCapacity ? opt.maxCapacity * 1 : 100).fill(1).map((v, index) => { pageData.table.id = opt.tableId
return (index + 1) + '人' pageData.table.tableCode = opt.tableCode
}) getTableInfo(opt)
getTableInfo(opt.tableId)
} }
getTbShopInfo() getTbShopInfo()
init() init()
@ -511,23 +509,26 @@
break; break;
case 'onboc_add': case 'onboc_add':
case 'add': case 'add':
cartItem = getNowCart(msg.data,$originGoods,pageData.user) cartItem = getNowCart(msg.data,$goods,pageData.user)
cartControls(cartItem,'add') cartControls(cartItem,'add')
break; break;
case 'onboc_edit': case 'onboc_edit':
case 'edit': case 'edit':
cartItem = getNowCart(msg.data,$originGoods,pageData.user) cartItem = getNowCart(msg.data,$goods,pageData.user)
cartControls(cartItem,'edit') cartControls(cartItem,'edit')
break; break;
case 'onboc_del': case 'onboc_del':
case 'del': case 'del':
cartItem = getNowCart(msg.data,$originGoods,pageData.user) cartItem = getNowCart(msg.data,$goods,pageData.user)
cartControls(cartItem,'del') cartControls(cartItem,'del')
break; break;
case 'onboc_cleanup': case 'onboc_cleanup':
case 'cleanup': case 'cleanup':
goods.lis = [] goods.lis = []
break; break;
case 'product_update':
init()
break;
} }
}); });
@ -556,7 +557,6 @@
let goodsRes = await getGoods() let goodsRes = await getGoods()
// await getCart() // await getCart()
$goods = goodsRes.records $goods = goodsRes.records
console.log($seatFee);
if (!$seatFee.totalNumber) { if (!$seatFee.totalNumber) {
updateChoseCount() updateChoseCount()
} }
@ -603,10 +603,16 @@
/** /**
* 获取桌台信息 * 获取桌台信息
*/ */
async function getTableInfo(id) { async function getTableInfo(opt) {
const res = await getShopTableDetail({id: id}) const res = await getShopTableDetail({id: opt.tableId,tableCode: opt.tableCode})
pageData.table = res Object.assign(pageData.table, res)
getHistoryOrderDetail(res.tableCode) 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() { async function updateChoseCount() {
const maxCapacity = pageData.table.id ? (pageData.table.maxCapacity || 0) : 100 const maxCapacity = pageData.table&&pageData.table.id ? (pageData.table.maxCapacity || 0) : 100
if (pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) { if (pageData.table&&pageData.table.id && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
uni.showToast({ uni.showToast({
title: '当前台桌最大人数为: ' + maxCapacity title: '当前台桌最大人数为: ' + maxCapacity
}) })
userNumbers.defaultCateIndex = maxCapacity - 1 userNumbers.defaultCateIndex = maxCapacity - 1
return return
} }
if (!pageData.shopInfo.isTableFee && pageData.table.id) { console.log(pageData.table)
if (!pageData.shopInfo.isTableFee && pageData.table && pageData.table.id) {
// //
let seatFee = { let seatFee = {
@ -827,10 +834,6 @@
userNumbers.defaultCateIndex = e.detail.value userNumbers.defaultCateIndex = e.detail.value
} }
function chooseUser() { function chooseUser() {
go.to('PAGES_CHOOSE_USER') go.to('PAGES_CHOOSE_USER')
} }
@ -841,11 +844,6 @@
}) })
} }
function watchChooseTable() { function watchChooseTable() {
uni.$off('choose-table') uni.$off('choose-table')
uni.$on('choose-table', (data) => { uni.$on('choose-table', (data) => {
@ -854,9 +852,6 @@
}) })
} }
function changeGoodsSel(index) { function changeGoodsSel(index) {
goods.sel = index goods.sel = index
} }
@ -878,23 +873,24 @@
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1; let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
let par = { let par = {
shopId: pageData.shopInfo.id, //Id shopId: pageData.shopInfo.id, //Id
userId: pageData.user.userId, //Id userId: pageData.user.userId, //Id
tableCode: pageData.table.tableCode, // tableCode: pageData.table.tableCode, //
dineMode: pageData.eatTypes.active, // dine-in take-out take-away dineMode: pageData.eatTypes.active, // dine-in take-out take-away
remark: pageData.form.note, // remark: pageData.form.note, //
seatNum: userNumbers.defaultCateIndex * 1 + 1, // seatNum: 0, //
packFee: $packFee.value, // packFee: $packFee.value, //
originAmount: goodsPrice.value, //+ originAmount: goodsPrice.value, //+
placeNum: placeNum, // placeNum: placeNum, //
waitCall: 0, // 0 1 waitCall: 0, // 0 1
vipPrice: vipPrice, //使 vipPrice: vipPrice, //使
} }
if(!pageData.shopInfo.isTableFee&&pageData.table&&pageData.table.id){
par.seatNum = userNumbers.defaultCateIndex * 1 + 1
}
if(pageData.shopInfo.registerType == 'after'&&pageData.orderInfo){ if(pageData.shopInfo.registerType == 'after'&&pageData.orderInfo){
par.orderId = pageData.orderInfo.id par.orderId = pageData.orderInfo.id
} }
console.log(userNumbers.defaultCateIndex * 1 + 1)
console.log(pageData.shopInfo.registerType)
const res = await createOrder(par) const res = await createOrder(par)
uni.$emit('update:createOrderIndex') uni.$emit('update:createOrderIndex')
websocketUtil.send(JSON.stringify({ websocketUtil.send(JSON.stringify({

View File

@ -25,11 +25,11 @@
<!-- 占位 --> <!-- 占位 -->
<view class="color-333 item border-top u-flex u-row-center u-row-between" <view class="color-333 item border-top u-flex u-row-center u-row-between"
v-for="(item,index) in data" :key="index"> v-for="(item,index) in data" :key="index">
<view class=""> <view>
<view class="u-line-1">{{item.name}}</view> <view class="up-line-1" >{{item.name}}</view>
<view class="u-m-t-10 u-font-24 color-666 u-line-1">{{item.specInfo||''}}</view> <view class="u-m-t-10 u-font-24 color-666 up-line-1">{{item.specInfo||''}}</view>
</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="font-bold red u-m-r-32">{{formatPrice(item.lowPrice*item.number) }}</view>
<view class="u-flex" @tap="updateNumber(false,index,item)"> <view class="u-flex" @tap="updateNumber(false,index,item)">
<image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode=""> <image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode="">
@ -51,7 +51,7 @@
</view> </view>
<view class="icon-car-box" @tap="toggleGoods"> <view class="icon-car-box" @tap="toggleGoods">
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" /> <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>
<view class="price font-bold u-flex"> <view class="price font-bold u-flex">
<view></view> <view></view>
@ -152,9 +152,9 @@
if (props.data.length <= 0) { if (props.data.length <= 0) {
return infoBox.showToast('还没有选择商品') return infoBox.showToast('还没有选择商品')
} }
const { name, maxCapacity, status, type } = props.table const { name, status, type } = props.table
console.log(props.table) console.log(props.table)
if (props.table.id == '') { if (props.table.id == ''&&props.table.tableCode == '') {
go.to('PAGES_CONFIRM_ORDER', { go.to('PAGES_CONFIRM_ORDER', {
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0 isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
}) })
@ -163,8 +163,8 @@
go.to('PAGES_CONFIRM_ORDER', { go.to('PAGES_CONFIRM_ORDER', {
type: type, type: type,
tableId: props.table.id, tableId: props.table.id,
tableCode: props.table.tableCode,
name:name, name:name,
maxCapacity:maxCapacity,
status:status, status:status,
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0 isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
}) })

View File

@ -97,6 +97,8 @@
arr.push(group) arr.push(group)
datas.selectNumber += ele.number datas.selectNumber += ele.number
}) })
console.log(arrlength)
console.log(datas.selectNumber)
if (arrlength == datas.selectNumber) { if (arrlength == datas.selectNumber) {
emits('confirm', arr, datas.item) emits('confirm', arr, datas.item)
close() close()

View File

@ -116,13 +116,6 @@
import { onLoad, onReady, onShow } from '@dcloudio/uni-app'; import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
import { computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue'; 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 util from './util.js';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import guigeModel from './components/guige' import guigeModel from './components/guige'
@ -130,8 +123,8 @@
import weighItem from './components/weigh.vue' import weighItem from './components/weigh.vue'
import listGoodsItem from './components/list-goods-item.vue' import listGoodsItem from './components/list-goods-item.vue'
import mySurcharge from './components/surcharge' import mySurcharge from './components/surcharge'
import myCar from './components/car' import myCar from './components/car'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import infoBox from '@/commons/utils/infoBox.js'; import infoBox from '@/commons/utils/infoBox.js';
import { getNowCart } from '@/pagesCreateOrder/util.js' import { getNowCart } from '@/pagesCreateOrder/util.js'
@ -149,7 +142,7 @@
import { getProductList } from '@/api/product.js' import { getProductList } from '@/api/product.js'
import { categoryPage } from '@/api/cateGory.js' import { categoryPage } from '@/api/cateGory.js'
import { inject } from 'vue'; import { inject } from 'vue';
import { getShopInfo } from '@/api/shop.js'
const modal = reactive({ const modal = reactive({
@ -194,8 +187,9 @@
is_gift: 0 is_gift: 0
}, },
orderId: null, orderId: null,
isCars: false,
isGoodsAdd: true,
goodsData: null,
}) })
const guigeModelData = reactive({ const guigeModelData = reactive({
title: '', title: '',
@ -213,6 +207,7 @@
onLoad((opt) => { onLoad((opt) => {
option = opt option = opt
console.log("opt===",opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
if (opt.useType) { if (opt.useType) {
uni.setStorageSync('useType', opt.useType) uni.setStorageSync('useType', opt.useType)
@ -224,6 +219,7 @@
isCreateOrderToDetail.value = true isCreateOrderToDetail.value = true
} }
init() init()
xiadanClick()
}) })
watch(() => data.table.id, (newval, oldval) => { watch(() => data.table.id, (newval, oldval) => {
if (option.type != 'add') { if (option.type != 'add') {
@ -249,6 +245,15 @@
onUnmounted(() => { onUnmounted(() => {
}); });
/**
* 判断是否允许下单
*/
let canXiadan = ref(false)
async function xiadanClick() {
canXiadan.value = await hasPermission('允许下单')
}
let $originGoods = [] let $originGoods = []
let $category = [] let $category = []
@ -257,8 +262,8 @@
if (option.type == 'add') { if (option.type == 'add') {
setTabBar($category, $originGoods, []) setTabBar($category, $originGoods, [])
} }
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(uni.getStorageSync("shopInfo")) const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
uni.setStorageSync('useType', useType) uni.setStorageSync('useType', useType)
// await getTableInfo() // await getTableInfo()
@ -276,14 +281,16 @@
return isShow; return isShow;
}); });
$originGoods = goods; $originGoods = goods;
if (option.type == 'add') { if (option.type == 'add') {
cars.length = 0 cars.length = 0
initCart()
setTabBar($category, goods, []) setTabBar($category, goods, [])
return return
} }
setTabBar($category, goods, cars) setTabBar($category, goods, cars)
initCart() initCart()
} }
@ -294,6 +301,8 @@
websocketUtil.onMessage(res => { websocketUtil.onMessage(res => {
let msg = JSON.parse(res); let msg = JSON.parse(res);
let cartItem; let cartItem;
let cartArr = [];
console.log(msg)
if( msg.msg_id ){ if( msg.msg_id ){
websocketUtil.send(JSON.stringify({ websocketUtil.send(JSON.stringify({
type: 'receipt', type: 'receipt',
@ -302,29 +311,42 @@
} }
if( msg.status == 0 ){ if( msg.status == 0 ){
infoBox.showToast('添加失败') 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) { switch (msg.operate_type) {
case 'onboc_init': case 'onboc_init':
cars.length = 0 cars.length = 0
data.isCars = true;
console.log("购物车信息onboc_init===",msg)
msg.data.map(item=>{ msg.data.map(item=>{
cartItem = getNowCart(item,$originGoods) cartItem = getNowCart(item,cartArr)
cartControls(cartItem,'add') cartControls(cartItem,'add')
}) })
uni.hideLoading()
break; break;
case 'onboc_add': case 'onboc_add':
case 'add': case 'add':
cartItem = getNowCart(msg.data,$originGoods) cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'add') cartControls(cartItem,'add')
infoBox.showToast('添加成功')
break; break;
case 'onboc_edit': case 'onboc_edit':
case 'edit': case 'edit':
cartItem = getNowCart(msg.data,$originGoods) cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'edit') cartControls(cartItem,'edit')
infoBox.showToast('添加成功')
break; break;
case 'onboc_del': case 'onboc_del':
case 'del': case 'del':
cartItem = getNowCart(msg.data,$originGoods) cartItem = getNowCart(msg.data,cartArr)
cartControls(cartItem,'del') cartControls(cartItem,'del')
break; break;
case 'onboc_cleanup': case 'onboc_cleanup':
@ -336,6 +358,13 @@
} }
} }
break; break;
case 'init':
case 'rottable':
initCart()
break;
case 'product_update':
init()
break;
} }
}); });
@ -351,6 +380,9 @@
table_code: data.table.tableCode, table_code: data.table.tableCode,
} }
websocketUtil.send(JSON.stringify(params)) websocketUtil.send(JSON.stringify(params))
} }
/** /**
@ -358,6 +390,7 @@
*/ */
function editCart (par,operate_type) { function editCart (par,operate_type) {
console.log('购物车添加菜品',par) console.log('购物车添加菜品',par)
if( !data.isGoodsAdd ){ return; }
let params = { let params = {
...data.socketData, ...data.socketData,
operate_type: operate_type, operate_type: operate_type,
@ -369,6 +402,7 @@
} }
Object.assign(params, par) Object.assign(params, par)
websocketUtil.send(JSON.stringify(params)) websocketUtil.send(JSON.stringify(params))
data.isGoodsAdd = false;
} }
/** /**
@ -461,11 +495,24 @@
return return
} }
console.log('---table:detail-----',item); 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) { if (data.table.id || cars.length <= 0) {
data.table = { data.table = {
...item ...item
} }
initCart() if( cars.length > 0){
websocketUtil.send(JSON.stringify(params))
}
// initCart()
return; return;
} }
if (item.status == "unbind") { if (item.status == "unbind") {
@ -475,7 +522,10 @@
return infoBox.showToast('该台桌已在使用中') return infoBox.showToast('该台桌已在使用中')
} }
data.table = item data.table = item
initCart() if( cars.length > 0){
websocketUtil.send(JSON.stringify(params))
}
// initCart()
} }
/** /**
@ -492,6 +542,10 @@
// chooseTable() // chooseTable()
// }) // })
// } // }
if( !data.isCars ){
return infoBox.showToast('购物车加载中请稍等...')
}
if( !data.isGoodsAdd ){ return; }
let $goods = data.tabbar[index].foods[foodsindex] let $goods = data.tabbar[index].foods[foodsindex]
if ($goods.type !== 'sku') { if ($goods.type !== 'sku') {
// //
@ -525,6 +579,7 @@
product_id: product_id, product_id: product_id,
sku_id: sku_id, sku_id: sku_id,
},'edit') },'edit')
data.isGoodsAdd = false;
setSearchGoods(searchGoodsIndex, number) setSearchGoods(searchGoodsIndex, number)
} else { } else {
// suit // suit
@ -539,7 +594,7 @@
product_id: product_id, product_id: product_id,
sku_id: sku_id, sku_id: sku_id,
},'add') },'add')
infoBox.showToast('添加成功') data.isGoodsAdd = false;
} }
} }
return return
@ -554,6 +609,7 @@
if( !data.table.tableCode ){ if( !data.table.tableCode ){
data.table.tableCode = cartItem.table_code data.table.tableCode = cartItem.table_code
} }
data.isGoodsAdd = true;
let cartIndex = 0; let cartIndex = 0;
let product_id = cartItem.product_id let product_id = cartItem.product_id
let sku_id = cartItem.sku_id let sku_id = cartItem.sku_id
@ -565,28 +621,19 @@
sku_id = item.sku_id sku_id = item.sku_id
} }
}) })
data.tabbar.map(tabbarItem=>{ data.tabbar.map(tabbarItem=>{
if(tabbarItem.foods.find(v => v.id == product_id)){ 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' ) { if( type == 'del' ) {
cars.splice(cartIndex, 1) cars.splice(cartIndex, 1)
$goods.chooseNumber = 0 if($goods)$goods.chooseNumber = 0;
return; return;
} }
if( type == 'add' ){ if( type == 'add' ){
cars.push(cartItem) cars.push(cartItem)
$goods.chooseNumber = cartItem.number if($goods)$goods.chooseNumber = cartItem.number
} }
if( type == 'edit' ){ if( type == 'edit' ){
cars[cartIndex].number = cartItem.number cars[cartIndex].number = cartItem.number
@ -602,6 +649,7 @@
*/ */
async function carsNumberChange(e) { async function carsNumberChange(e) {
console.log("carsNumberChange===",e) console.log("carsNumberChange===",e)
if( !data.isGoodsAdd ){ return; }
let $sku; let $sku;
let $goods; let $goods;
data.tabbar.map(tabbarItem=>{ data.tabbar.map(tabbarItem=>{
@ -626,6 +674,7 @@
product_id: e.goods.product_id, product_id: e.goods.product_id,
sku_id: e.goods.sku_id sku_id: e.goods.sku_id
},'edit') },'edit')
data.isGoodsAdd = false;
} }
/** /**
@ -635,15 +684,47 @@
*/ */
async function taocanConfirm(d, item) { async function taocanConfirm(d, item) {
console.log(d) console.log(d)
editCart({ let carGoods = null;
number: item.skuList[0].suitNum, cars.some(item=>{
product_id: item.id, if(item.product_id == data.goodsData.id){
sku_id: item.skuList[0].id, let arr = []
pro_group_info: JSON.stringify(d), JSON.parse(item.pro_group_info).some((v,i)=>{
},'add') 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({}); let selGoods = ref({});
/** /**
* 打开规格弹窗 * 打开规格弹窗
@ -656,10 +737,14 @@
// chooseTable() // chooseTable()
// }) // })
// } // }
if( !data.isCars ){
return infoBox.showToast('购物车加载中请稍等...')
}
const $goods = data.tabbar[index].foods[foodsindex] const $goods = data.tabbar[index].foods[foodsindex]
console.log($goods) console.log($goods)
selGoods.value = $goods selGoods.value = $goods
if ($goods.groupType == 1) { if ($goods.groupType == 1) {
data.goodsData = $goods
instance.ctx.$refs.taocanModelRef.open() instance.ctx.$refs.taocanModelRef.open()
} else { } else {
console.log($goods) console.log($goods)
@ -716,6 +801,7 @@
*/ */
async function guigeConfirm(sku, suitNum) { async function guigeConfirm(sku, suitNum) {
console.log(sku) console.log(sku)
if( !data.isGoodsAdd ){ return; }
let goods = guigeModelData.chooseGoods.item let goods = guigeModelData.chooseGoods.item
let sku_id = sku.id let sku_id = sku.id
let product_id = goods.id let product_id = goods.id
@ -732,7 +818,8 @@
number: newNumber, number: newNumber,
product_id: product_id, product_id: product_id,
sku_id: sku_id, sku_id: sku_id,
},'add') },'edit')
data.isGoodsAdd = false;
} else { } else {
// //
editCart({ editCart({
@ -740,7 +827,7 @@
product_id: product_id, product_id: product_id,
sku_id: sku_id, sku_id: sku_id,
},'add') },'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 refweighitem = ref(null)
const tapweigh = (foodsindex, index) => { const tapweigh = (foodsindex, index) => {
if( !data.isCars ){
return infoBox.showToast('购物车加载中请稍等...')
}
const goods = data.tabbar[index].foods[foodsindex] const goods = data.tabbar[index].foods[foodsindex]
refweighitem.value.open(foodsindex, index, goods) refweighitem.value.open(foodsindex, index, goods)
} }

View File

@ -10,7 +10,6 @@ export function getNowCart(carItem,goodsList,user) {
if(carItem.product_id == goodsItem.id){ if(carItem.product_id == goodsItem.id){
goodsItem.skuList.map(item=>{ goodsItem.skuList.map(item=>{
if(carItem.sku_id == item.id){ if(carItem.sku_id == item.id){
console.log(item)
carItem.lowPrice = item.salePrice carItem.lowPrice = item.salePrice
carItem.lowMemberPrice = item.memberPrice carItem.lowMemberPrice = item.memberPrice
carItem.specInfo = item.specInfo carItem.specInfo = item.specInfo

View File

@ -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>

View File

@ -4,13 +4,13 @@
<text class="">桌号</text> <text class="">桌号</text>
<text class="">{{orderInfo.tableName||""}}</text> <text class="">{{orderInfo.tableName||""}}</text>
</view> </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" <view class="block" @tap="rotatingTables"
style="display: flex;align-items: center;justify-content: space-between;"> style="display: flex;align-items: center;justify-content: space-between;">
<view>转桌/并桌</view> <view>转桌/并桌</view>
<uni-icons type="right" color="#999" size="16"></uni-icons> <uni-icons type="right" color="#999" size="16"></uni-icons>
</view> </view>
</view> </view> -->
<view class=" color-999 border-bottom u-p-b-24"> <view class=" color-999 border-bottom u-p-b-24">
<text></text> <text></text>
<text class="color-333 "> {{goodsNumber}}</text> <text class="color-333 "> {{goodsNumber}}</text>
@ -55,7 +55,7 @@
</view> </view>
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount"> <view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
<view class="color-666">退款金额:</view> <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>
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum"> <view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
<view class="color-666">退菜数量:</view> <view class="color-666">退菜数量:</view>
@ -70,7 +70,6 @@
</view> </view>
</view> </view>
<view class="u-text-right u-m-t-28"> <view class="u-text-right u-m-t-28">
{{isTui(item)}}
<template v-if="isTui(item)"> <template v-if="isTui(item)">
<view>0.00</view> <view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
@ -79,6 +78,10 @@
<view>0.00</view> <view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}</view> <view class="line-th color-666 ">{{returnTotalMoney(item)}}</view>
</template> </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-else>
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1"> <template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
<view>{{returnTotalMoney(item)}}</view> <view>{{returnTotalMoney(item)}}</view>
@ -96,7 +99,7 @@
</view> </view>
</view> </view>
<template v-if="canTuicai(orderInfo,item)"> <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 :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 <my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
class="no-wrap">退菜</text></my-button> class="no-wrap">退菜</text></my-button>
@ -134,10 +137,10 @@
已优惠{{youhuiAllPrice}} 已优惠{{youhuiAllPrice}}
</view> </view>
</view> </view>
<view> <!-- <view>
<text>小计</text> <text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text> <text class="font-bold u-font-32">{{allPrice}}</text>
</view> </view> -->
</view> </view>
</view> </view>
@ -162,18 +165,25 @@
</view> </view>
</view> </view>
</template> </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 class="u-flex u-row-between u-m-t-20">
<view></view> <view></view>
<template v-if="orderInfo.status=='unpaid'"> <template v-if="orderInfo.status=='unpaid'">
<view> <view>
<text>总计</text> <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> </view>
</template> </template>
<template v-else> <template v-else>
<view> <view>
<text>总计</text> <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> </view>
</template> </template>
@ -358,7 +368,20 @@
function returnTotalMoney(item) { function returnTotalMoney(item) {
return (item.payAmount).toFixed(2) 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 canTuiKuanPrice = computed(() => {
const goodsTotal = props.data.reduce((prve, cur) => { const goodsTotal = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId) const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
@ -396,19 +419,7 @@
return seatFee 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) { function to2(n) {
if (!n) { if (!n) {
@ -424,10 +435,27 @@
function tuikuan(item, index) { function tuikuan(item, index) {
hasPermission('允许退款').then(res => { hasPermission('允许退款').then(res => {
if (res) { if (res) {
emits('tuikuan', { if (Array.isArray(item)) {
...item, let arr = [];
payAmount: item.payAmount console.log(item)
}, index) 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) { if (props.orderInfo.discountAmount) {
return props.orderInfo.discountAmount return props.orderInfo.discountAmount
} }
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio)) return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
}) })
const goodsOriginAllPrice = computed(() => { const goodsOriginAllPrice = computed(() => {
@ -513,7 +540,7 @@
* 已优惠金额 * 已优惠金额
*/ */
const youhuiAllPrice = computed(() => { 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) return (n < 0 ? 0 : n).toFixed(2)
}) })
@ -531,7 +558,6 @@
}) })
const allPrice = computed(() => { const allPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => { const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a, const curTotal = cur.info.reduce((a,
b) => { b) => {

View File

@ -29,11 +29,11 @@
</template> </template>
<view class="u-flex u-m-t-24 u-row-between u-font-28"> <view class="u-flex u-m-t-24 u-row-between u-font-28">
<view class=""> <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 class="color-666 u-m-t-8 u-font-24">余额</view>
</view> </view>
<view class=""> <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 class="color-666 u-m-t-8 u-font-24">积分</view>
</view> </view>
<view class=""> <view class="">

View File

@ -15,7 +15,7 @@
<view style="height: 200rpx;"></view> <view style="height: 200rpx;"></view>
<view class="u-fixed bottom bg-fff "> <view class="u-fixed bottom bg-fff ">
<view class="u-flex u-abso"> <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'"> <view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
<my-button @tap="toPay" borderRadius="100rpx" shape="circle" <my-button @tap="toPay" borderRadius="100rpx" shape="circle"
type="primary">结账</my-button> type="primary">结账</my-button>
@ -41,6 +41,8 @@
</template> </template>
<script setup> <script setup>
import { onLoad, onShow } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import * as Api from '@/http/yskApi/Instead.js' import * as Api from '@/http/yskApi/Instead.js'
import userVue from './components/user.vue'; import userVue from './components/user.vue';
import orderVue from './components/order.vue'; import orderVue from './components/order.vue';
@ -48,19 +50,16 @@
import stepVue from './components/step.vue'; import stepVue from './components/step.vue';
import extraVue from './components/extra.vue'; import extraVue from './components/extra.vue';
import tuicaiVue from './components/tuicai.vue'; import tuicaiVue from './components/tuicai.vue';
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import {hasPermission} from '@/commons/utils/hasPermission.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 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 { shopStaffDetail } from '@/api/staff.js'
import { shopUserDetail } from '@/api/shopUser.js' import { shopUserDetail } from '@/api/shopUser.js'
import { getShopInfo } from '@/api/shop.js'
const tuicai = reactive({ const tuicai = reactive({
show: false, show: false,
@ -82,9 +81,13 @@
amount:'0.00', amount:'0.00',
accountPoints:'0.00' accountPoints:'0.00'
}) })
const pageData = reactive({
shopInfo: {},
})
onLoad((opt) => { onLoad((opt) => {
Object.assign(options, opt) Object.assign(options, opt)
console.log(options); console.log("opt===",options);
getShopInfoData()
}) })
onShow(() => { onShow(() => {
watchEmit() watchEmit()
@ -92,7 +95,14 @@
getOrderDetail() 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}) let res = await getHistoryOrder({orderId: options.id})
console.log(res) console.log(res)
if(res.userId){ if(res.userId){
shopUserDetail({id:res.userId}).then(res=>{ shopUserDetail({userId:res.userId}).then(res=>{
if(res){ if(res){
user.value = res user.value = res
} }
@ -115,7 +125,7 @@
info: value, info: value,
placeNum: key placeNum: key
})) }))
console.log(orderDetail.goodsList); console.log("goodsList===",orderDetail.goodsList);
orderDetail.info = res orderDetail.info = res
} }
@ -156,7 +166,7 @@
productName, productName,
num, num,
number: 0, number: 0,
productSkuName: '', skuName: '',
priceAmount, priceAmount,
price price
}) })
@ -177,28 +187,24 @@
getOrderDetail() 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() { function onPrintOrder() {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否打印当前台桌菜品', content: '是否打印当前台桌菜品',
success(res) { async success(res) {
if (res.confirm) { if (res.confirm) {
printDishes() try {
const res = await printOrder({
id: orderDetail.info.id
})
infoBox.showToast('已发送打印请求')
} catch (e) {
infoBox.showToast('发送打印请求失败')
}
} }
} }
}) })
@ -211,32 +217,22 @@
return return
} }
console.log(goods,'debug'); console.log(goods,'debug');
const { if (Array.isArray(goods)) {
id, go.to('PAGES_ORDER_TUIKUAN', {
productId, goodsList:JSON.stringify(goods)
productSkuId,
productName, })
productSkuName, } else {
cartId, goods.number = 0
orderId, goods.skuName = goods.skuName || ''
num, goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*goods.unitPrice).toFixed(2)
priceAmount, goods.unitPrice = goods.unitPrice
price,userCouponId goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
} = goods go.to('PAGES_ORDER_TUIKUAN', {
go.to('PAGES_ORDER_TUIKUAN', { goodsList:JSON.stringify([goods])
id, })
cartId, }
orderId,
productId,
productSkuId,
productName,
num,
number: 0,
productSkuName: productSkuName || '',
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
price,
userCouponId:userCouponId?userCouponId:''
})
} }
@ -256,10 +252,10 @@
clearEmit() clearEmit()
go.to('PAGES_CREATE_ORDER', { go.to('PAGES_CREATE_ORDER', {
tableId: options.tableId || orderDetail.info.tableId, tableId: options.tableId || orderDetail.info.tableId,
tableCode: options.tableCode || orderDetail.info.tableCode,
name: options.name || orderDetail.info.tableName, name: options.name || orderDetail.info.tableName,
masterId:orderDetail.info.masterId,
type: 'add', type: 'add',
vipUserId:orderDetail.userId?orderDetail.userId:'' vipUserId: orderDetail.info.userId?orderDetail.info.userId:''
}) })
} }
@ -272,8 +268,8 @@
clearEmit() clearEmit()
go.to('PAGES_ORDER_PAY', { go.to('PAGES_ORDER_PAY', {
tableId: options.tableId|| orderDetail.info.tableId, tableId: options.tableId|| orderDetail.info.tableId,
tableName: options.name, tableCode: options.tableCode || orderDetail.info.tableCode,
masterId: options.masterId, tableName: options.name || orderDetail.info.tableName,
orderId: orderDetail.info.id, orderId: orderDetail.info.id,
discount: 1, discount: 1,
userId userId

View File

@ -98,7 +98,7 @@
<view class="u-m-t-32"> <view class="u-m-t-32">
<view class="u-flex u-row-right"> <view class="u-flex u-row-right">
<text>总计</text> <text>总计</text>
<text class="font-bold u-font-32">{{data.orderAmount}}</text> <text class="font-bold u-font-32">{{data.originAmount}}</text>
</view> </view>
<view class="u-flex u-row-right u-m-t-24"> <view class="u-flex u-row-right u-m-t-24">
<view class="print" @click.stop="print(item)">重新打印</view> <view class="print" @click.stop="print(item)">重新打印</view>

View File

@ -21,12 +21,11 @@
import { reactive, ref, watch } from 'vue'; import { reactive, ref, watch } from 'vue';
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app' import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
import LIST from '@/commons/class/list.js' import LIST from '@/commons/class/list.js'
import {$printOrder} from '@/http/yskApi/Instead.js'
import filterVue from './compoents/filter.vue'; import filterVue from './compoents/filter.vue';
import orderList from './compoents/order-list.vue'; import orderList from './compoents/order-list.vue';
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.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({ const search = reactive({
placeholder: '搜索单号/商品名称', placeholder: '搜索单号/商品名称',
@ -84,33 +83,25 @@
* 是否打印该订单 * 是否打印该订单
* @param {Object} e * @param {Object} e
*/ */
function onPrintOrder(e){ function onPrintOrder(item){
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '是否打印该订单', content: '是否打印该订单',
success(res) { async success(res) {
if (res.confirm) { 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 * @param {Object} e

View File

@ -99,7 +99,19 @@
<text class="u-m-l-10 no-wrap">{{item.payName}}</text> <text class="u-m-l-10 no-wrap">{{item.payName}}</text>
</view> </view>
<view class="u-flex color-999 u-font-24"> <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"> @click.stop="chooseUser">
<view> <view>
<text>会员</text> <text>会员</text>
@ -228,7 +240,6 @@
import { reactive, onMounted, watch, ref, onBeforeUnmount, computed } from 'vue'; import { reactive, onMounted, watch, ref, onBeforeUnmount, computed } from 'vue';
import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app' import { onLoad, onBackPress, onShow } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js' import go from '@/commons/utils/go.js'
import * as Api from '@/http/yskApi/Instead.js'
import { hasPermission } from '@/commons/utils/hasPermission.js' import { hasPermission } from '@/commons/utils/hasPermission.js'
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
@ -244,8 +255,9 @@
import { getCouponList } from '@/api/coupon.js' import { getCouponList } from '@/api/coupon.js'
import { getHistoryOrder } from '@/api/order.js' import { getHistoryOrder } from '@/api/order.js'
import { getPayTypeList } from '@/api/payType.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 { shopUserDetail } from '@/api/shopUser.js'
import { calcUsablePoints,calcDeductionAmount,payedDeductPoints,consumeAwardPoints } from '@/api/points.js'
const modal = reactive({ const modal = reactive({
@ -265,7 +277,8 @@
user: { // user: { //
userId: null, userId: null,
amount: 0 amount: 0
} },
buyer: {}
}) })
const order = reactive({ const order = reactive({
orderAmount: 0 orderAmount: 0
@ -279,7 +292,8 @@
list: [], list: [],
selIndex: 0 selIndex: 0
}, },
quan: [] quan: [],
seatNum: 0
}) })
// //
const discount = reactive({ const discount = reactive({
@ -305,6 +319,7 @@
let payCodeUrl = ref('') // let payCodeUrl = ref('') //
onShow(() => { onShow(() => {
watchChooseuser() watchChooseuser()
watchChoosebuyer()
watchChooseQuan() watchChooseQuan()
}) })
onLoad(async (opt) => { onLoad(async (opt) => {
@ -345,19 +360,20 @@
setQuan([...fullReductionCoupon, ...productCoupon]) setQuan([...fullReductionCoupon, ...productCoupon])
// //
console.log(order.userId) console.log("pageData.user===",pageData.user)
console.log(!pageData.user.userId) if (order.userId||pageData.user.userId) {
if (order.userId&&!pageData.user.userId) {
calcUsablePoints()
if (orderRes.pointsNum) {
accountPoints.sel = true
}
shopUserDetail({ shopUserDetail({
userId: order.userId || pageData.user.userId userId: order.userId || pageData.user.userId
}).then(res => { }).then(res => {
pageData.user = 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 coupAllPrice = computed(() => {
const n = pays.quan.reduce((prve, cur) => { const n = pays.quan.reduce((prve, cur) => {
@ -383,13 +399,12 @@
* 订单金额 * 订单金额
*/ */
const originPrice = computed(() => { const originPrice = computed(() => {
console.log(order) console.log("order===",order)
console.log(packAmount)
if(pageData.goodsList){ if(pageData.goodsList){
let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => { let goodsPrice = pageData.goodsList.filter(v => v.price != 0 && v.status !== "return").reduce((a, b) => {
return a + (b.num * b.price) return a + (b.num * b.price)
}, 0) }, 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) console.log("accountPoints===",accountPoints)
let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount let total = (originPrice.value*1) - discountSaleAmount.value - (vipDiscount.value*1) - productCouponDiscountAmount.value - discount
.value - fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0) .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) console.log(total)
return (total < 0 ? 0 : total).toFixed(2) return (total < 0 ? 0 : total).toFixed(2)
}) })
@ -473,12 +498,14 @@
} }
}) })
watch(() => pointCanDicountPrice.value, (newval) => { watch(() => pointCanDicountPrice.value, (newval) => {
calcUsablePoints() if( pageData.user.id ){
getCalcUsablePoints()
}
}) })
watch(() => payPrice.value, (newval) => { watch(() => payPrice.value, (newval) => {
getPayUrl() getPayUrl()
if (newval <= 0) { if (newval <= 0) {
const arr = ['cash', 'virtual'] const arr = ['cash', 'member-account']
pays.payTypes.list.map(v => { pays.payTypes.list.map(v => {
if (arr.includes(v.payType)) { if (arr.includes(v.payType)) {
v.disabled = false v.disabled = false
@ -514,27 +541,37 @@
}, 2000) }, 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 * 获取店铺订单支付URL
*/ */
function getPayUrl() { function getPayUrl() {
console.log(vipDiscount.value) console.log(discount)
let par = { console.log(getPayParam())
let par = getPayParam()
let params = {
shopId: uni.getStorageSync("shopInfo").id, shopId: uni.getStorageSync("shopInfo").id,
orderId: order.id, ...par
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, // 使
} }
if( order.userId||pageData.user.userId ){ 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 payCodeUrl.value = res
}) })
} }
@ -545,10 +582,14 @@
*/ */
async function getPayType() { async function getPayType() {
const payTypeList = await getPayTypeList() const payTypeList = await getPayTypeList()
pays.payTypes.list = payTypeList.map(v => { pays.payTypes.list = [];
return { payTypeList.map(v => {
...v, if( v.payType != 'bank'){
disabled: false
pays.payTypes.list.push({
...v,
disabled: false
})
} }
}) })
} }
@ -558,13 +599,12 @@
* @param {Object} arr * @param {Object} arr
*/ */
function setQuan(arr) { function setQuan(arr) {
console.log(arr); console.log("choose-quan===",arr)
discount.discount = 100 discount.discount = 100
discount.value = 0 discount.value = 0
discount.currentPrice = order.orderAmount discount.currentPrice = order.orderAmount
const manjianCoup = arr.filter(v => v.type == 1 && v.number >= 1) const manjianCoup = arr.filter(v => v.type == 1 && v.number >= 1)
let productCoup = arr.filter(v => v.type == 2) let productCoup = arr.filter(v => v.type == 2)
console.log(productCoup);
// //
let coupMap = {} let coupMap = {}
for (let i in productCoup) { for (let i in productCoup) {
@ -575,7 +615,6 @@
coupMap[coup.proId] = [coup] coupMap[coup.proId] = [coup]
} }
} }
console.log(coupMap);
for (let key in coupMap) { for (let key in coupMap) {
const arr = coupMap[key] const arr = coupMap[key]
for (let i in arr) { for (let i in arr) {
@ -594,9 +633,7 @@
} }
} }
productCoup = productCoup.filter(v => v.number >= 1) productCoup = productCoup.filter(v => v.number >= 1)
console.log(productCoup);
pays.quan = [...manjianCoup, ...productCoup] pays.quan = [...manjianCoup, ...productCoup]
console.log(pays.quan);
} }
@ -625,12 +662,18 @@
function pointsConfirm(e) { function pointsConfirm(e) {
accountPoints.num = e accountPoints.num = e
} }
async function calcUsablePoints(orderAmount) {
/**
* 获取积分信息
* @param {Object} orderAmount
*/
async function getCalcUsablePoints(orderAmount) {
if (!order.userId&&!pageData.user.userId) { if (!order.userId&&!pageData.user.userId) {
return return
} }
const res = await Api.$calcUsablePoints({ console.log("calcUsablePoints",pageData.user)
userId: order.userId||pageData.user.userId, const res = await calcUsablePoints({
userId: pageData.user.id,
orderAmount: orderAmount ? orderAmount : payPrice.value orderAmount: orderAmount ? orderAmount : payPrice.value
}) })
accountPoints.calcRes = res accountPoints.calcRes = res
@ -643,9 +686,9 @@
accountPoints.price = 0 accountPoints.price = 0
return '' return ''
} }
const res = await Api.$calcDeDuctionPoints({ const res = await calcDeductionAmount({
userId: order.userId||pageData.user.userId, userId: pageData.user.id,
orderAmount: originPrice.value, orderAmount: orderAmount.value,
points: accountPoints.num points: accountPoints.num
}) })
if (res) { 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 * @param {Object} form
@ -768,9 +830,13 @@
pays.payTypes.selIndex = i pays.payTypes.selIndex = i
console.log(item.payType) console.log(item.payType)
console.log(pageData.user.id) console.log(pageData.user.id)
if (item.payType == 'virtual' && !pageData.user.id) { if (item.payType == 'member-account' && !pageData.user.id) {
chooseUser() chooseUser()
} }
if (item.payType == 'virtual' && !pageData.buyer.id) {
chooseBuyer()
}
} }
@ -799,13 +865,16 @@
function payOrderClick() { function payOrderClick() {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
console.log(payType); console.log(payType);
if (payType == 'scanCode' || payType == 'deposit' || payType == 'bank') { if (payType == 'scanCode' || payType == 'deposit') {
return saomaPay(payType) return saomaPay(payType)
} }
if (payType == 'cash' && payPrice.value * 1 > 0) { if (payType == 'cash' && payPrice.value * 1 > 0) {
return cashConfirmShow() 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('余额不足') infoBox.showToast('余额不足')
return return
} }
@ -826,55 +895,60 @@
*/ */
async function pay(par) { async function pay(par) {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
let pars = getPayParam()
console.log(payType) console.log(payType)
console.log(discount) console.log(discount)
payStatus = 'paying' payStatus = 'paying'
let params = { let params = {
shopId: uni.getStorageSync("shopInfo").id, shopId: uni.getStorageSync("shopInfo").id,
checkOrderPay: { 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 => { couponList: pays.quan.map(v => {
return { return {
userCouponId: v.id, userCouponId: v.id,
num: v.number num: v.number
} }
}), }),
...par ...pars
}, },
...par
} }
if( order.userId||pageData.user.userId ){ if( order.userId||pageData.user.userId ){
params.checkOrderPay.userId = order.userId||pageData.user.userId params.checkOrderPay.userId = order.userId||pageData.user.userId
} }
if( payType == 'virtual' ){
params.creditBuyerId = pageData.buyer.id
}
console.log(params) console.log(params)
if (payType == 'scanCode' || payType == 'deposit' || payType == 'bank') { try {
} if (payType == 'scanCode') {
if (payType == 'cash' && payPrice.value * 1 > 0) { await microPay(params)
try { }
if (payType == 'cash') {
await cashPay(params) await cashPay(params)
} catch (error) {
payStatus = '';
return false;
} }
} if (payType == 'virtual') {
if (payType == 'virtual' && pageData.user.amount * 1 > order.orderAmount * 1) { await creditPay(params)
params.payType = 'userPay'
params.shopUserId = pageData.user.id
try {
await vipPay(params)
} catch (error) {
payStatus = '';
return false;
} }
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() paySuccess()
} }

View File

@ -226,7 +226,7 @@
console.log(pageData.order); console.log(pageData.order);
const res = await getFindCoupon({ const res = await getFindCoupon({
shopUserId: option.shopUserId, shopUserId: option.shopUserId,
type: pageData.types.sel type: pageData.types.sel+1
}) })
let fullReductionCoupon = res.filter(v => v.type == 1) let fullReductionCoupon = res.filter(v => v.type == 1)
let productCoupon = res.filter(v => v.type == 2) let productCoupon = res.filter(v => v.type == 2)
@ -340,7 +340,7 @@
*/ */
function changeFullReductionCouponSel(item) { function changeFullReductionCouponSel(item) {
if (!item.use) { if (!item.use) {
// return return
} }
console.log(item); console.log(item);
if (item.id == pageData.fullReductionCouponSel.id) { if (item.id == pageData.fullReductionCouponSel.id) {

View File

@ -132,10 +132,11 @@ export function returnProCoupStartIndex(coupArr,index){
} }
//返回商品数量从0到n每一个对应的价格对照表 //返回商品数量从0到n每一个对应的价格对照表
export function returnGoodsPayPriceMap(goodsArr){ export function returnGoodsPayPriceMap(goodsArr){
let goods_arr = [] let goods_arr = [{}]
Object.values(goodsArr).forEach(item=>{ Object.values(goodsArr).forEach(item=>{
goods_arr = [...goods_arr,...item] goods_arr = [...goods_arr,...item]
}) })
console.log(goods_arr)
return goods_arr.reduce((prve,cur)=>{ return goods_arr.reduce((prve,cur)=>{
if(!prve.hasOwnProperty(cur.productId)){ if(!prve.hasOwnProperty(cur.productId)){
prve[cur.productId]=[] prve[cur.productId]=[]

View File

@ -15,10 +15,10 @@
v-for="(item,index) in orderDetail.goodsList" :key="index"> v-for="(item,index) in orderDetail.goodsList" :key="index">
<view> <view>
<view>{{item.productName}}</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 class="u-m-t-10 color-999 u-font-24">最多可退×{{item.num}}</view>
</view> </view>
<template v-if="option.productId=='-999'"> <template v-if="item.productId=='-999'">
<view class="u-flex"> <view class="u-flex">
<view class="color-red" >{{item.priceAmount}}</view> <view class="color-red" >{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center"> <view class="u-flex u-m-l-32 u-col-center">
@ -28,7 +28,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="u-flex"> <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"> <view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon> <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> <view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
@ -86,31 +86,39 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import color from '@/commons/color.js'; import color from '@/commons/color.js';
import infoBox from '@/commons/utils/infoBox.js'; import infoBox from '@/commons/utils/infoBox.js';
import * as orderApi from '@/http/yskApi/order.js'
import {hasPermission} from '@/commons/utils/hasPermission.js' import {hasPermission} from '@/commons/utils/hasPermission.js'
import { import { refundOrder } from '@/api/order.js'
$returnOrder
} from '@/http/yskApi/Instead.js'
import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
computed,
reactive,
ref,
watch
} from 'vue';
let allTui = ref(false) let allTui = ref(false)
let note = ref('') let note = ref('')
const tuikuan = reactive({ const tuikuan = reactive({
list: ['点错', '数量点错', '客人要求', '协商退费'], list: ['点错', '数量点错', '客人要求', '协商退费'],
sel: -1 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) { function changeTuiKuanSel(i) {
tuikuan.sel = 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(() => { const totalNumber = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => { return orderDetail.goodsList.reduce((prve, cur) => {
@ -147,7 +150,10 @@
const tuikuanPrice = computed(() => { const tuikuanPrice = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => { return orderDetail.goodsList.reduce((prve, cur) => {
const n=(cur.number/cur.num*100) * cur.priceAmount 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) }, 0)
}) })
@ -171,7 +177,10 @@
item.number = newval; item.number = newval;
allTui.value = totalNumber.value == tuikuanNumber.value ? true : false; allTui.value = totalNumber.value == tuikuanNumber.value ? true : false;
} }
/**
* 确认退款
*/
async function tuikuanConfirm() { async function tuikuanConfirm() {
const canTuikuan=await hasPermission('允许退款') const canTuikuan=await hasPermission('允许退款')
if(!canTuikuan){ if(!canTuikuan){
@ -185,36 +194,27 @@
if (!noteResult) { if (!noteResult) {
return infoBox.showToast('请输入或选择退款原因!') return infoBox.showToast('请输入或选择退款原因!')
} }
await $returnOrder({ let params = {
"orderId": option.orderId, orderId: option.orderId,
"note":noteResult, refundAmount: orderDetail.goodsList.reduce((prve, cur) => {
"orderDetails":orderDetail.goodsList.filter(v=>v.number*1).map(v=>{ return prve + (cur.number * 1 * cur.unitPrice)
}, 0),
refundReason: noteResult,
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
return { return {
id:v.id, id:v.id,
num:v.number*1 returnAmount: v.number * 1 * v.unitPrice,
num: v.number * 1
} }
}) })
}) }
await refundOrder(params)
infoBox.showToast('退款请求提交成功') infoBox.showToast('退款请求提交成功')
setTimeout(()=>{ setTimeout(()=>{
uni.navigateBack({delta:1}) uni.navigateBack({delta:1})
},500) },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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>