代客下单修改,登录页面修改,部分页面调整,请求封装调整
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
<template v-else>
|
||||
<view class="fixed top bg-fff u-flex u-flex-row">
|
||||
<template v-if="true">
|
||||
<view
|
||||
class="u-flex u-font-32 u-p-l-58"
|
||||
style="padding-right: 100rpx"
|
||||
@click="uni.navigateBack()"
|
||||
>
|
||||
<up-icon name="arrow-left" size="32rpx" color="#333"></up-icon>
|
||||
<text class="u-m-l-20">返回</text>
|
||||
</view>
|
||||
<view class="u-flex-1 u-flex u-flex-row" style="overflow-x: scroll">
|
||||
<!-- 顶部左侧 -->
|
||||
<scroll-view
|
||||
@@ -33,13 +41,13 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
<!-- 顶部右侧 选择桌台什么的 -->
|
||||
<view class="search-box u-flex u-col-center color-666">
|
||||
<view class="search-box u-flex u-col-center color-333 u-font-32">
|
||||
<!-- <view style="display: flex;align-items: center;">
|
||||
<view :class="[lvhong?'lvstyle':'hongstyle']">
|
||||
</view><text style="margin: 0 6px;">状态</text>
|
||||
</view> -->
|
||||
<view class="u-flex u-col-center" @click="chooseTable">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-flex u-col-center u-m-r-22">
|
||||
<image
|
||||
src="/pagesCreateOrder/static/images/icon-table.svg"
|
||||
mode=""
|
||||
@@ -51,7 +59,7 @@
|
||||
<text class="font-bold u-m-r-4 no-wrap">
|
||||
{{ data.table.name }}
|
||||
</text>
|
||||
<view
|
||||
<!-- <view
|
||||
class="u-flex"
|
||||
@click.stop="resetTable"
|
||||
style="margin-left: 6px"
|
||||
@@ -62,42 +70,46 @@
|
||||
bold=""
|
||||
:size="24"
|
||||
></up-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<text class="no-wrap" v-else>选择桌台</text>
|
||||
<text class="no-wrap" v-else>换台</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="u-flex u-col-center"
|
||||
@click="toOrder"
|
||||
style="margin-left: 20px"
|
||||
style="margin-left: 74rpx"
|
||||
>
|
||||
<view class="u-flex">
|
||||
<up-icon name="order" size="24"></up-icon>
|
||||
<image
|
||||
src="/static/iconImg/order.svg"
|
||||
style="width: 40rpx; height: 40rpx"
|
||||
/>
|
||||
</view>
|
||||
<view class="u-m-r-12">已点订单</view>
|
||||
|
||||
<view class="u-m-l-22">已点订单</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="margin-left: 74rpx"
|
||||
class="u-flex u-col-center"
|
||||
@click="changePop('search', true)"
|
||||
>
|
||||
<view class="u-flex">
|
||||
<view class="u-flex u-m-r-22">
|
||||
<up-icon name="search" size="24"></up-icon>
|
||||
</view>
|
||||
<view class="">搜索</view>
|
||||
</view>
|
||||
<view class="u-flex u-col-center u-m-l-10">
|
||||
<!-- <view class="u-flex u-col-center u-m-l-10" @click="loginShow"> -->
|
||||
<view class="u-flex">
|
||||
<up-icon name="account" size="24"></up-icon>
|
||||
</view>
|
||||
<view>{{ data.userInfo.shopName }}</view>
|
||||
<!-- <view style="color: #aaa;font-size: 12px;">切换</view> -->
|
||||
<view
|
||||
class="color-333 u-font-32 font-700"
|
||||
style="margin-left: 87px"
|
||||
>{{ accountStore.shopStaff.name }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="u-flex u-col-center u-m-l-10" @click="loginShowOut">
|
||||
<view class="u-flex u-col-center u-m-l-38" @click="loginShowOut">
|
||||
<view class="u-flex">
|
||||
<!-- <up-icon name="account" size="24"></up-icon> -->
|
||||
</view>
|
||||
@@ -226,6 +238,7 @@
|
||||
@updateSafeBottom="updateSafeBottom"
|
||||
:instance="instance"
|
||||
@updateCart="getCart"
|
||||
@updateCartRemark="updateCartRemark"
|
||||
:sysInfo="sysInfo"
|
||||
:isCreateOrderToDetail="isCreateOrderToDetail"
|
||||
@updateNumber="carsNumberChange"
|
||||
@@ -235,6 +248,7 @@
|
||||
:data="cars"
|
||||
:orderInfo="data.orderInfo"
|
||||
:historyOrder="data.historyOrder"
|
||||
:tableCode="data.table.tableCode"
|
||||
@clear="cleaCart"
|
||||
></my-car>
|
||||
</view>
|
||||
@@ -295,7 +309,9 @@
|
||||
import _ from "lodash";
|
||||
import * as Api from "@/http/yskApi/Instead.js";
|
||||
import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js";
|
||||
import * as padApi from "@/http/yskApi/pad.js";
|
||||
|
||||
|
||||
|
||||
import {
|
||||
$table,
|
||||
$choseTable,
|
||||
@@ -347,6 +363,13 @@ import { getNowCart } from "@/pagesCreateOrder/util.js";
|
||||
// import yskUtils from "ysk-utils";
|
||||
import yskUtils from "@/lib/index";
|
||||
provide("yskUtils", yskUtils);
|
||||
|
||||
import {useAccountStore} from '@/stores/account'
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
provide("accountStore", accountStore);
|
||||
|
||||
|
||||
import {
|
||||
$productCategory,
|
||||
$layoutpage,
|
||||
@@ -450,6 +473,7 @@ const layoutArr = {
|
||||
};
|
||||
const tabsEle = reactive({
|
||||
scrollWidth: 0,
|
||||
scroViewllLeft: 0,
|
||||
tabsItems: [],
|
||||
scrollLeft: 0,
|
||||
});
|
||||
@@ -494,7 +518,6 @@ function onMessage() {
|
||||
data.isGoodsAdd = true;
|
||||
// 如果是商品库存不足起售数量
|
||||
if (msg.type == "no_suit_num") {
|
||||
// cartItem = getNowCart(msg.data, cartArr)
|
||||
cartControls([], "del");
|
||||
}
|
||||
return;
|
||||
@@ -602,15 +625,15 @@ function delCart(id) {
|
||||
* 获取订单详情
|
||||
*/
|
||||
async function getHistoryOrderDetail() {
|
||||
if(shopInfo.registerType=='before'){
|
||||
return
|
||||
if (shopInfo.registerType == "before") {
|
||||
return;
|
||||
}
|
||||
data.historyOrder = [];
|
||||
let res = await getHistoryOrder({
|
||||
tableCode: data.table.tableCode,
|
||||
});
|
||||
data.orderInfo = res.data;
|
||||
if (res.data) {
|
||||
data.orderInfo = res;
|
||||
if (res) {
|
||||
data.historyOrder = Object.entries(data.orderInfo.detailMap).map(
|
||||
([key, value]) => ({
|
||||
info: value,
|
||||
@@ -1018,10 +1041,13 @@ function changeCategorySel(index) {
|
||||
|
||||
function setTabsCurrentPosition(position = "center") {
|
||||
const index = layoutData.category.sel;
|
||||
console.log(tabsEle.tabsItems[index]);
|
||||
console.log(tabsEle.scroViewllLeft);
|
||||
tabsEle.scrollLeft =
|
||||
tabsEle.tabsItems[index].left -
|
||||
tabsEle.scrollWidth / 2 +
|
||||
tabsEle.tabsItems[index].width / 2;
|
||||
tabsEle.tabsItems[index].width / 2 -
|
||||
tabsEle.scroViewllLeft;
|
||||
}
|
||||
const shopInfo = uni.getStorageSync("shopInfo");
|
||||
|
||||
@@ -1042,13 +1068,13 @@ async function getGoodsData(max = 6, isGetPrve = false) {
|
||||
try {
|
||||
const res2 = await $productCategory(pageData.id);
|
||||
layoutData.list[layoutData.current + i * fuhao] = {
|
||||
...res2.data,
|
||||
padLayoutCode: res2.data.padLayoutCode
|
||||
? res2.data.padLayoutCode
|
||||
: res2.data.productList.length <= 4
|
||||
? layoutArr[res2.data.productList.length]
|
||||
...res2,
|
||||
padLayoutCode: res2.padLayoutCode
|
||||
? res2.padLayoutCode
|
||||
: res2.productList.length <= 4
|
||||
? layoutArr[res2.productList.length]
|
||||
: "6-grid",
|
||||
productList: res2.data.productList.map((v) => {
|
||||
productList: res2.productList.map((v) => {
|
||||
v.salePrice = v.lowPrice;
|
||||
const findGoodsInCar = cars.find((cars) => {
|
||||
return cars.productId == v.id;
|
||||
@@ -1140,16 +1166,15 @@ async function init() {
|
||||
if (option.type == "add") {
|
||||
setTabBar($category, $originGoods, []);
|
||||
}
|
||||
// shopInfo.value = uni.getStorageSync('shopInfo').data
|
||||
let shopInfo = await getShopInfo({
|
||||
id: uni.getStorageSync("shopInfo").id,
|
||||
});
|
||||
uni.setStorageSync("shopInfo", shopInfo.data);
|
||||
uni.setStorageSync("shopInfo", shopInfo);
|
||||
// 获取布局
|
||||
// const getLayoutData = await getLayout({})
|
||||
// 获取分类数据-获取商品分类
|
||||
const categoryRes = await getCategory();
|
||||
$category = categoryRes.data;
|
||||
$category = categoryRes;
|
||||
|
||||
let arr = [];
|
||||
for (let i = 0; i < $category.length; i++) {
|
||||
@@ -1166,8 +1191,8 @@ async function init() {
|
||||
// }
|
||||
// })
|
||||
const content =
|
||||
res.data.records.length > 0
|
||||
? res.data.records
|
||||
res.records.length > 0
|
||||
? res.records
|
||||
: [
|
||||
{
|
||||
productCategoryId: $category[i].id,
|
||||
@@ -1194,7 +1219,7 @@ async function init() {
|
||||
});
|
||||
getLayoutGoodsInit();
|
||||
// 获取商品数据
|
||||
const { data: goodsRes } = await getGoods();
|
||||
const goodsRes = await getGoods();
|
||||
const goods = goodsRes.filter((v) => {
|
||||
let isShow = true;
|
||||
if (v.type != "sku") {
|
||||
@@ -1218,11 +1243,13 @@ function categoryEleInit() {
|
||||
rect: true,
|
||||
}).then((res) => {
|
||||
tabsEle.scrollWidth = res.width;
|
||||
tabsEle.scroViewllLeft = res.left;
|
||||
});
|
||||
for (let i in layoutData.category.list) {
|
||||
getElRect("u-tab-item" + i, instance.value, {
|
||||
rect: true,
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
tabsEle.tabsItems[i] = {
|
||||
width: res.width,
|
||||
left: res.left,
|
||||
@@ -1317,9 +1344,11 @@ function chooseTable() {
|
||||
// setTimeout(() => {
|
||||
// changeCategorySel(0)
|
||||
// }, 500)
|
||||
go.to("PAGES_CHOOSE_TABLE", {
|
||||
...data.table,
|
||||
});
|
||||
|
||||
go.to("PAGES_INDEX_CHOOSE_TABLE");
|
||||
// go.to("PAGES_CHOOSE_TABLE", {
|
||||
// ...data.table,
|
||||
// });
|
||||
}
|
||||
|
||||
async function confirmModelConfirm(isCancel = false) {
|
||||
@@ -1682,6 +1711,21 @@ function editCart(par, operate_type) {
|
||||
}
|
||||
const $cacheGoods = {};
|
||||
|
||||
//修改购物车商品备注
|
||||
function updateCartRemark(e) {
|
||||
let { remark, index, goods } = e;
|
||||
cars[index].note = remark;
|
||||
let params = {
|
||||
number: e.num,
|
||||
id: e.goods.id,
|
||||
product_id: e.goods.product_id,
|
||||
sku_id: e.goods.sku_id,
|
||||
is_temporary: e.goods.is_temporary,
|
||||
remark: remark,
|
||||
};
|
||||
editCart(params, "edit");
|
||||
}
|
||||
|
||||
//购物车商品数量改变
|
||||
async function carsNumberChange(e) {
|
||||
if (!data.isGoodsAdd) {
|
||||
@@ -1909,7 +1953,7 @@ async function onSelTable() {
|
||||
data.masterId = masterId;
|
||||
const cartRes = await getCart();
|
||||
cars.length = 0;
|
||||
const cartArr = getNowCart(cartRes.data);
|
||||
const cartArr = getNowCart(cartRes);
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i]);
|
||||
}
|
||||
@@ -1973,7 +2017,7 @@ let sysInfo = ref({
|
||||
const limitTimeDiscountRes = ref(null);
|
||||
async function getLimit() {
|
||||
const res = await limitTimeDiscountApi.limitTimeDiscount();
|
||||
limitTimeDiscountRes.value = res.data;
|
||||
limitTimeDiscountRes.value = res;
|
||||
if (data.table.tableCode) {
|
||||
data.limitTimeDiscount = limitTimeDiscountRes.value;
|
||||
|
||||
@@ -1990,11 +2034,22 @@ async function getLimit() {
|
||||
console.log("limitTimeDiscount", data.limitTimeDiscount);
|
||||
}
|
||||
}
|
||||
|
||||
async function getTableDetail() {
|
||||
let res = await $returnTableDetail({
|
||||
tableCode: data.table.tableCode,
|
||||
});
|
||||
console.log(res, "getTableDetail");
|
||||
if(res){
|
||||
data.table = res;
|
||||
}
|
||||
}
|
||||
onLoad(async (opt) => {
|
||||
sysInfo.value = uni.getSystemInfoSync();
|
||||
uni.hideTabBar();
|
||||
// option = opt
|
||||
Object.assign(data.table, opt);
|
||||
await getTableDetail();
|
||||
await getLimit();
|
||||
if (opt.useType) {
|
||||
uni.setStorageSync("useType", opt.useType);
|
||||
@@ -2034,7 +2089,7 @@ onLoad(async (opt) => {
|
||||
// right: 0;
|
||||
// top: 0;
|
||||
// bottom: 0;
|
||||
padding-right: 30rpx;
|
||||
padding-right: 58rpx;
|
||||
background-color: #fff;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -2109,7 +2164,7 @@ $u-main-color: $my-main-color;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
padding: 10px 16px;
|
||||
padding: 28rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -2118,6 +2173,7 @@ $u-main-color: $my-main-color;
|
||||
color: #444;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
margin-right: 56rpx;
|
||||
}
|
||||
|
||||
.u-tab-item-active {
|
||||
|
||||
Reference in New Issue
Block a user