diff --git a/http/yskApi/Instead.js b/http/yskApi/Instead.js index f086402..6ab725f 100644 --- a/http/yskApi/Instead.js +++ b/http/yskApi/Instead.js @@ -7,7 +7,18 @@ import { } from 'js-base64' import infoBox from '@/commons/utils/infoBox.js' -const request=http.request +const request = http.request + + +//就餐形式,默认堂食后付费 +const useType = 'dine-in-after' + +function getUseType() { + const type = uni.getStorageSync("useType") + return type ? type : useType +} + + /** * 获取当前台桌订单信息 * @returns @@ -17,12 +28,12 @@ export function getCart(params) { url: `/api/place/cart`, method: "get", params:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...params } }); } - /** * 已上架商品列表 * @returns @@ -32,7 +43,7 @@ export function getGoodsLists(params) { url: `/api/place/activate`, method: "get", params:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...params } }); @@ -47,7 +58,8 @@ export function addCart(data) { url: `/api/place/addCart`, method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -62,7 +74,8 @@ export function $clearCart(data) { url: `/api/place/clearCart`, method: "delete", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -77,7 +90,8 @@ export function $removeCart(data) { url: `/api/place/removeCart`, method: "delete", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -91,7 +105,7 @@ export function $updateCart(data) { url: `/api/place/updateCart`, method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -105,7 +119,7 @@ export function $allPack(data) { url: `/api/place/pack`, method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -119,7 +133,8 @@ export function $getMasterId(data) { url: `/api/place/masterId`, method: "get", params:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -133,7 +148,7 @@ export function $getPayType(data) { url: `/api/place/payType`, method: "get", params:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -147,7 +162,8 @@ export function $createOrder(data) { url: `/api/place/order`, method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -163,7 +179,8 @@ export function $cacheOrder(data) { url: `/api/place/pending`, method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -178,7 +195,8 @@ export function $getCacheOrder(data) { url: `/api/place/pending/cart`, method: "get", params:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -190,7 +208,7 @@ export function $setUser(data) { url: `/api/place/updateVip`, method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -201,7 +219,7 @@ export function $delOrder(data) { url: `/api/place/order`, method: "delete", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -212,19 +230,19 @@ export function $payOrder(data) { url: '/api/place/pay', method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); } - //退单 + export function $returnCart(data) { return request({ url: '/api/place/returnCart', method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -235,7 +253,7 @@ export function $choseTable(data) { url: '/api/place/choseTable', method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -247,7 +265,8 @@ export function $choseCount(data) { url: '/api/place/choseCount', method: "put", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), + useType: getUseType(), ...data } }); @@ -259,7 +278,7 @@ export function $fastCreateTable(data) { url: '/api/tbShopTable/generate', method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -271,7 +290,7 @@ export function $printOrder(data) { url: '/api/place/printOrder', method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); @@ -283,9 +302,20 @@ export function $printDishes(data) { url: '/api/place/printDishes', method: "post", data:{ - shopId: uni.getStorageSync('shopId'), + shopId: uni.getStorageSync("shopId"), ...data } }); } +// 就餐模式切换 +export function $changeUseType(data) { + return request({ + url: '/api/place/choseModel', + method: "put", + data:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); +}