This commit is contained in:
parent
490c513f48
commit
cc97b6acca
|
|
@ -2,10 +2,10 @@ import http from '@/http/http.js'
|
|||
const request = http.request
|
||||
// 商品----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* 获取商品列表
|
||||
* 获取商品分页
|
||||
* @returns
|
||||
*/
|
||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/page`,
|
||||
method: "GET",
|
||||
|
|
@ -16,6 +16,22 @@ export function getProductList(data, urlType = 'product' ,showLoading) {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
* @returns
|
||||
*/
|
||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/list`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
},
|
||||
showLoading
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
* @returns
|
||||
|
|
@ -59,7 +75,7 @@ export function delProduct(id, urlType = 'product') {
|
|||
*/
|
||||
export function productOnOff (data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/on-off`,
|
||||
url: `${urlType}/admin/product/onOff`,
|
||||
method: "POST",
|
||||
data: {
|
||||
...data
|
||||
|
|
|
|||
|
|
@ -1,6 +1,20 @@
|
|||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 营业板块
|
||||
* @returns
|
||||
*/
|
||||
export function getTrade(data, urlType = 'order') {
|
||||
return request({
|
||||
url: `${urlType}/admin/data/summary/trade`,
|
||||
method: "GET",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品销售汇总
|
||||
* @returns
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export function canComputedPackFee(v) {
|
||||
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding'
|
||||
return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'part_refund'
|
||||
}
|
||||
export function returnCanComputedGoodsArr(arr) {
|
||||
return arr.filter(v => canComputedPackFee(v))
|
||||
|
|
@ -18,7 +18,8 @@ export function canTuicai(orderInfo, item) {
|
|||
}
|
||||
export function canTuiKuan(orderInfo, item) {
|
||||
if( item ){
|
||||
return orderInfo.status == 'done' && item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
|
||||
return (orderInfo.status == 'done' || orderInfo.status == 'part_refund')
|
||||
&& item.status != 'return' && item.status != 'refund' && item.status != 'refunding'
|
||||
} else {
|
||||
let goodsList = []
|
||||
let data = false;
|
||||
|
|
@ -29,7 +30,7 @@ export function canTuiKuan(orderInfo, item) {
|
|||
console.log("goodsList===",goodsList)
|
||||
goodsList.some((v,i)=>{
|
||||
console.log(v)
|
||||
if( orderInfo.status == 'done' && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' ){
|
||||
if( (orderInfo.status == 'done' || orderInfo.status == 'part_refund') && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' ){
|
||||
data = true
|
||||
console.log(data)
|
||||
return data
|
||||
|
|
@ -44,7 +45,7 @@ export function isTuiCai(item) {
|
|||
return item.status == 'return' || item.status == 'part_refund'
|
||||
}
|
||||
export function isTui(item) {
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||
return item.status == 'return' || item.status == 'refund' || item.status == 'part_refund'
|
||||
}
|
||||
export function isGift(item) {
|
||||
return !isTui(item) && item.isGift == 1
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class WebsocketUtil {
|
|||
|
||||
this.socketTask.onOpen((res) => {
|
||||
console.log('WebSocket连接正常!==',res);
|
||||
this.send(JSON.stringify({"type": "ping_interval22"}));
|
||||
this.isOpen = true;
|
||||
// 连接成功后启动心跳和消息监听
|
||||
this.startHeartbeat();
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive,ref,onMounted } from 'vue';
|
||||
import { $tbShopCategory, $tbProductV2 } from "@/http/yskApi/goods.js"
|
||||
import { getProductList, getCategoryList } from '@/api/product.js'
|
||||
import { reactive,ref,onMounted } from 'vue';
|
||||
import { $tbShopCategory, $tbProductV2 } from "@/http/yskApi/goods.js"
|
||||
import { getProductPage, getCategoryList } from '@/api/product.js'
|
||||
const props=defineProps({
|
||||
show:{
|
||||
type:Boolean,
|
||||
|
|
@ -78,7 +78,7 @@ import { $tbShopCategory, $tbProductV2 } from "@/http/yskApi/goods.js"
|
|||
})
|
||||
}
|
||||
function getGoodsList () {
|
||||
getProductList(category.query).then(res => {
|
||||
getProductPage(category.query).then(res => {
|
||||
category.goodsList = res.records.map(v => {
|
||||
return {
|
||||
...v,
|
||||
|
|
|
|||
|
|
@ -196,7 +196,12 @@
|
|||
let delConfirm = () => {
|
||||
pageData.delShow = false;
|
||||
delCreditBuyer(pageData.delItem.id).then(res => {
|
||||
getList()
|
||||
if( pageData.query.page > 1 && pageData.list.length == 1){
|
||||
pageData.query.page--
|
||||
getList()
|
||||
} else {
|
||||
getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
*/
|
||||
function inputEvent(d) {
|
||||
pageData.query.paymentMethod = pageData.query.paymentMethod.replace(/\s*/g, "");
|
||||
pageData.query.size = 1;
|
||||
pageData.query.page = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import { categoryPage } from '@/api/cateGory.js'
|
||||
import { getProductList,getProdGroupDetail,updateProdGroup } from '@/api/product.js'
|
||||
import { getProductPage,getProdGroupDetail,updateProdGroup } from '@/api/product.js'
|
||||
|
||||
const pageData = reactive({
|
||||
stateCurrent: 0,
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
* 获取商品列表
|
||||
*/
|
||||
function getGoodsList() {
|
||||
getProductList(pageData.query).then(res => {
|
||||
getProductPage(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
let goodsList = res.records.map(v => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@
|
|||
</view>
|
||||
|
||||
</template>
|
||||
<template v-if="FormData.type == 'weigh'">
|
||||
<template v-if="FormData.type == 'weight'">
|
||||
<view class="block u-p-t-32 u-p-b-32">
|
||||
<view class="font-bold">
|
||||
<text class="color-red">*</text>
|
||||
|
|
@ -543,7 +543,7 @@
|
|||
},
|
||||
{
|
||||
name: '称重商品',
|
||||
value: 'weigh'
|
||||
value: 'weight'
|
||||
},
|
||||
// {
|
||||
// name: '团购券',
|
||||
|
|
@ -1126,7 +1126,7 @@
|
|||
FormData.proGroupVo[0].number = null
|
||||
}
|
||||
}
|
||||
if (type == 'weigh') {
|
||||
if (type == 'weight') {
|
||||
if (!FormData.weight) {
|
||||
return infoBox.showToast('请输入重量')
|
||||
}
|
||||
|
|
@ -1408,6 +1408,7 @@
|
|||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
bottom: 60px;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.minus {}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
<script setup>
|
||||
import { reactive, onMounted, ref, watch, computed } from 'vue';
|
||||
import { getProductList} from '@/api/product.js';
|
||||
import { getProductPage} from '@/api/product.js';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
},
|
||||
{
|
||||
name: '称重',
|
||||
value: 'weigh'
|
||||
value: 'weight'
|
||||
},
|
||||
// {
|
||||
// name: '团购券',
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
*/
|
||||
function getGoods() {
|
||||
const arr=selArr
|
||||
getProductList(goods.query).then(res => {
|
||||
getProductPage(goods.query).then(res => {
|
||||
let selLen=0;
|
||||
goods.list = res.records.map(v => {
|
||||
const checked=$selGoodsMap[v.id]?true:false
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<template v-if="data.skuList.length>=1">
|
||||
<template v-if="data.type == 'sku' && data.skuList.length>=1">
|
||||
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top" :style="skuStyle">
|
||||
<view class="u-font-24 info-p-l u-m-t-6">规格:</view>
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
$updateProductData
|
||||
} from "@/http/yskApi/goods.js"
|
||||
import {
|
||||
getProductList,
|
||||
getProductPage,
|
||||
getCategoryList,
|
||||
updateProduct
|
||||
} from '@/api/product.js'
|
||||
|
|
@ -223,7 +223,7 @@
|
|||
*/
|
||||
function getGoodsList() {
|
||||
pageData.hasAjax = false
|
||||
getProductList(pageData.query).then(res => {
|
||||
getProductPage(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
pageData.goodsList = res.records.map(v => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -10,36 +10,20 @@
|
|||
|
||||
<view class="pageSalesSummaryContent">
|
||||
<view class="">
|
||||
<view class="">
|
||||
实收金额(元)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.sale?list.sale.incomeAmountAll:0}}
|
||||
</view>
|
||||
<view class=""> 实收金额(元) </view>
|
||||
<view class=""> {{list.sale?list.sale.incomeAmountAll:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
优惠金额(元)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.count?list.count.saveAmount:0}}
|
||||
</view>
|
||||
<view class=""> 优惠金额(元) </view>
|
||||
<view class=""> {{list.count?list.count.saveAmount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
客单价(元)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.count?list.count.unitPrice:0}}
|
||||
</view>
|
||||
<view class=""> 客单价(元) </view>
|
||||
<view class=""> {{list.count?list.count.unitPrice:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
会员消费(元)
|
||||
</view>
|
||||
<view class="">
|
||||
{{list.vip?list.vip.useAmount:0}}
|
||||
</view>
|
||||
<view class=""> 会员消费(元) </view>
|
||||
<view class=""> {{list.vip?list.vip.useAmount:0}} </view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
|
|
@ -59,34 +43,6 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="table-scroll">
|
||||
<!-- <table class="table" cellspacing="0">
|
||||
<thead class="thead">
|
||||
<tr style="background-color: #aebad2;color: #fff;" height='41'>
|
||||
<th style="width: 540rpx;">商品名称</th>
|
||||
<th style="width: 215rpx;">总数量</th>
|
||||
<th>金额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="tbody">
|
||||
<tr v-for="(item,index) in tableList" :key="item.productId">
|
||||
<td style="width: 500rpx;padding-left: 16rpx;">
|
||||
<image v-if="index==0" src="../pageTable/index/images/1.png" style="width: 22rpx;height: 30rpx;"
|
||||
mode=""></image>
|
||||
<image v-else-if="index==1" src="../pageTable/index/images/2.png"
|
||||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
||||
<image v-else-if="index==2" src="../pageTable/index/images/3.png"
|
||||
style="width: 22rpx;height: 30rpx;" mode=""></image>
|
||||
<span v-else>{{index}}</span>
|
||||
{{item.productName}}
|
||||
</td>
|
||||
<td style="padding-left: 16rpx;">{{item.num}}</td>
|
||||
<td style="padding-left: 16rpx;">{{item.salesAmount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
-->
|
||||
|
||||
|
||||
<template>
|
||||
<view class="color-333 u-font-28 bg-gray default-box-padding" style="padding-top:80px;">
|
||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||
|
|
@ -114,7 +70,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- <view style="height: 100px;"></view> -->
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
|
@ -125,20 +80,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, getCurrentInstance, ref } from 'vue';
|
||||
import datePickerview from './components/my-date-pickerview.vue'
|
||||
import {
|
||||
summaryTrade,
|
||||
dateProduct
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import {
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
ref
|
||||
} from 'vue';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { productSaleDate } from '@/api/summary.js'
|
||||
|
||||
import { getTrade, productSaleDate } from '@/api/summary.js'
|
||||
|
||||
const timeList = [{
|
||||
label: '今天',
|
||||
|
|
@ -165,13 +111,16 @@
|
|||
const currentInstance = getCurrentInstance()
|
||||
let tableList = ref([])
|
||||
let day = ref(1)
|
||||
|
||||
function toUrl() {
|
||||
go.to('PAGES_PRODUCT_SALES_RANKING', {
|
||||
day: day.value
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getlist()
|
||||
gettableData()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取营业数据
|
||||
* @param {Object} start
|
||||
* @param {Object} end
|
||||
*/
|
||||
function getlist(start, end) {
|
||||
let startTime, endTime;
|
||||
if (selected.value == 'today') {
|
||||
|
|
@ -200,37 +149,17 @@
|
|||
startTime = s + ' 00:00:00'
|
||||
endTime = e + ' 23:59:59'
|
||||
}
|
||||
summaryTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
getTrade({
|
||||
beginTime: startTime,
|
||||
endTime: endTime,
|
||||
}).then((res) => {
|
||||
list.value = res
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
getlist()
|
||||
gettableData()
|
||||
})
|
||||
|
||||
function datePickerConfirm(e) {
|
||||
getlist(e.start, e.end)
|
||||
// gettableData() day如日期不能是1 7 30 就回报错
|
||||
|
||||
}
|
||||
|
||||
function changeTime(e) {
|
||||
|
||||
selected.value = e
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
} else {
|
||||
getlist()
|
||||
gettableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 获取表格数据
|
||||
|
||||
/**
|
||||
* 获取销售数据
|
||||
*/
|
||||
function gettableData() {
|
||||
if (selected.value == 'today') {
|
||||
day.value = 1
|
||||
|
|
@ -248,11 +177,14 @@
|
|||
page: 1,
|
||||
size: 5
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.content
|
||||
tableList.value = res.productList.records
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 获取当前时间
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
*/
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
const y = dt.getFullYear();
|
||||
|
|
@ -263,7 +195,10 @@
|
|||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
// 获取昨天时间
|
||||
|
||||
/**
|
||||
* 获取昨天时间
|
||||
*/
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
let dateFormat = new Date(strDate);
|
||||
|
|
@ -274,6 +209,39 @@
|
|||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间切换
|
||||
* @param {Object} e
|
||||
*/
|
||||
function changeTime(e) {
|
||||
selected.value = e
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
} else {
|
||||
getlist()
|
||||
gettableData()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义确认
|
||||
* @param {Object} e
|
||||
*/
|
||||
function datePickerConfirm(e) {
|
||||
getlist(e.start, e.end)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更多
|
||||
*/
|
||||
function toUrl() {
|
||||
go.to('PAGES_PRODUCT_SALES_RANKING', {
|
||||
day: day.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,4 @@
|
|||
<template>
|
||||
<!-- <view class="table-scroll">
|
||||
<table cellspacing="0">
|
||||
<thead>
|
||||
<tr style="background-color: #aebad2;color: #fff;" height='41'>
|
||||
<th>商品名称</th>
|
||||
<th>数量</th>
|
||||
<th>金额</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in tableList" :key="item.productId">
|
||||
<td style="padding-left: 16rpx;">{{item.productName}}</td>
|
||||
<td style="padding-left: 16rpx;">{{item.num}}</td>
|
||||
<td style="padding-left: 16rpx;">{{item.salesAmount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</view> -->
|
||||
<template>
|
||||
<view class="color-333 u-font-28 bg-gray default-box-padding" >
|
||||
<scroll-view :scroll-x="true" class="bg-fff table u-text-center">
|
||||
|
|
@ -36,40 +18,36 @@
|
|||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- <view style="height: 100px;"></view> -->
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onMounted,
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
summaryTrade,
|
||||
dateProduct
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { productSaleDate } from '@/api/summary.js'
|
||||
|
||||
let tableList = ref([])
|
||||
let props = defineProps({
|
||||
day: {
|
||||
type: Number
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
gettableData()
|
||||
})
|
||||
// 获取表格数据
|
||||
|
||||
/**
|
||||
* 获取销售数据
|
||||
*/
|
||||
function gettableData() {
|
||||
dateProduct({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productSaleDate({
|
||||
day: props.day,
|
||||
page: 0,
|
||||
size: 50
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.content
|
||||
tableList.value = res.productList.records
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,18 +35,16 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance, ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import {
|
||||
summaryTrade,
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import {
|
||||
getCurrentInstance,
|
||||
ref
|
||||
} from 'vue';
|
||||
import datePickerview from './my-date-pickerview.vue'
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
|
||||
import { getTrade } from '@/api/summary.js'
|
||||
|
||||
let selected = ref('today')
|
||||
let showAll = ref(false);
|
||||
let $list = []
|
||||
|
|
@ -121,10 +119,9 @@
|
|||
startTime = s + ' 00:00:00'
|
||||
endTime = e + ' 23:59:59'
|
||||
}
|
||||
summaryTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
getTrade({
|
||||
beginTime: startTime,
|
||||
endTime: endTime,
|
||||
}).then((res) => {
|
||||
$list = res.sale.payCount
|
||||
setList()
|
||||
|
|
|
|||
|
|
@ -47,45 +47,27 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
onMounted,
|
||||
nextTick
|
||||
} from 'vue';
|
||||
import {
|
||||
onShareAppMessage,
|
||||
onShareTimeline
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reqLoad,
|
||||
API_URL_SYS_ARTICLES,
|
||||
$indexStatistics,
|
||||
$getSiteInfos
|
||||
} from '@/http/apiManager.js';
|
||||
import { reactive, ref, onMounted, nextTick } from 'vue';
|
||||
import { onPullDownRefresh, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import Stats from './components/Stats.vue';
|
||||
import statistics from './components/statistics.vue'
|
||||
import {
|
||||
onPullDownRefresh,
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
|
||||
|
||||
uni.hideTabBar()
|
||||
let shopName = ref()
|
||||
onLoad((options) => {
|
||||
shopName.value = uni.getStorageSync('shopName');
|
||||
});
|
||||
|
||||
let totalRevenuedata = ref()
|
||||
let totalRevenue = (d) => {
|
||||
totalRevenuedata.value = d
|
||||
}
|
||||
|
||||
let showTips = ref(false)
|
||||
|
||||
function toggleTips() {
|
||||
showTips.value = !showTips.value
|
||||
}
|
||||
|
|
@ -282,6 +264,22 @@
|
|||
|
||||
|
||||
];
|
||||
|
||||
const vdata = reactive({
|
||||
noticeList: [], // 公告列表
|
||||
adList: [],
|
||||
shareImgUrl: '' //分享图片
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
shopName.value = uni.getStorageSync('shopName');
|
||||
});
|
||||
|
||||
// 启动加载
|
||||
onMounted(() => {
|
||||
// refData();
|
||||
});
|
||||
|
||||
// 如果不是超管 删除 刷脸广告菜单
|
||||
if (storageManage.userInfo().userType != 1) {
|
||||
const index = navList.findIndex((v) => v.entId == 'ENT_ADVERT_CONTROL');
|
||||
|
|
@ -290,36 +288,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
const vdata = reactive({
|
||||
noticeList: [], // 公告列表
|
||||
adList: [],
|
||||
shareImgUrl: '' //分享图片
|
||||
});
|
||||
|
||||
|
||||
// 刷新数据 async 异步函数, 每个查询需要返回promise对象,并标识await
|
||||
async function refData() {
|
||||
// 查询公告列表
|
||||
|
||||
// 调用子组件方法 , 避免组件没有加载完成。
|
||||
|
||||
// nextTick(() => statsRef.value.refData());
|
||||
// 停止刷新
|
||||
// 停止刷新
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
// 获取 统计数据
|
||||
const getIndexStat = (time) => {
|
||||
$indexStatistics(time).then(({
|
||||
bizData
|
||||
}) => {
|
||||
vdata.statInfo = bizData.dayCount;
|
||||
});
|
||||
};
|
||||
|
||||
// 启动加载
|
||||
onMounted(() => {
|
||||
// refData();
|
||||
});
|
||||
// 微信分享
|
||||
|
||||
/**
|
||||
* 微信分享
|
||||
*/
|
||||
onShareAppMessage((res) => {
|
||||
if (res.from == 'menu')
|
||||
return {
|
||||
|
|
@ -328,7 +307,10 @@
|
|||
imageUrl: vdata.shareImgUrl
|
||||
};
|
||||
});
|
||||
// 分享到朋友圈
|
||||
|
||||
/**
|
||||
* 分享到朋友圈
|
||||
*/
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: uni.$appName,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<view class="u-m-t-24 border discount u-relative u-flex input-box">
|
||||
<view class="u-flex-1">
|
||||
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
|
||||
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
|
||||
placeholder-class="placeholder-class" placeholder="请输入最终优惠金额" />
|
||||
</view>
|
||||
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
|
||||
<view>元</view>
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@
|
|||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
import { getShopInfo } from '@/api/shop.js'
|
||||
import { getShopTableDetail } from '@/api/table.js'
|
||||
import { getProductList } from '@/api/product.js'
|
||||
import { getProductPage } from '@/api/product.js'
|
||||
import { createOrder,getHistoryOrder } from '@/api/order.js'
|
||||
import { number } from 'uview-plus/libs/function/test';
|
||||
|
||||
|
|
@ -568,7 +568,7 @@
|
|||
* 获取商品列表
|
||||
*/
|
||||
function getGoods() {
|
||||
return getProductList({
|
||||
return getProductPage({
|
||||
page: 1,
|
||||
size: 300
|
||||
},'product', false)
|
||||
|
|
@ -871,15 +871,16 @@
|
|||
|
||||
let vipPrice = isVip.value ? 1 : 0
|
||||
let placeNum = pageData.shopInfo.registerType == 'after'&&pageData.orderInfo ? pageData.orderInfo.placeNum + 1 : 1;
|
||||
let originAmount = goodsPrice.value*1+youhui.value*1
|
||||
let par = {
|
||||
shopId: pageData.shopInfo.id, //店铺Id
|
||||
userId: pageData.user.userId, //用户Id
|
||||
tableCode: pageData.table.tableCode, //台桌编码
|
||||
dineMode: pageData.eatTypes.active, //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
remark: pageData.form.note, //备注
|
||||
seatNum: 0, //用餐人数
|
||||
seatNum: 0, //用餐人数
|
||||
packFee: $packFee.value, //打包费
|
||||
originAmount: goodsPrice.value, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: originAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
placeNum: placeNum, //当前订单下单次数
|
||||
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||
vipPrice: vipPrice, //是否使用会员价
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<view class="u-font-32 font-bold u-m-t-16">
|
||||
¥{{data.lowPrice}}
|
||||
</view>
|
||||
<template v-if="data.type=='weigh'">
|
||||
<template v-if="data.type=='weight'">
|
||||
<view class="btnweigh">称重</view>
|
||||
</template>
|
||||
</view>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
</template>
|
||||
<template v-else>
|
||||
<view class="u-flex icon-btn">
|
||||
<view class="u-flex" @tap.stop="emitEvent(data.type=='weigh'?'tapweigh':'add')">
|
||||
<view class="u-flex" @tap.stop="emitEvent(data.type=='weight'?'tapweigh':'add')">
|
||||
<image src="/pagesCreateOrder/static/images/icon-add.svg" class="icon" mode=""></image>
|
||||
</view>
|
||||
<template v-if="data.chooseNumber">
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
},
|
||||
|
||||
table: {
|
||||
id: ""
|
||||
id: "",
|
||||
},
|
||||
socketData: {
|
||||
type:'onboc',
|
||||
|
|
@ -218,6 +218,9 @@
|
|||
if (JSON.stringify(opt) == '{}') {
|
||||
isCreateOrderToDetail.value = true
|
||||
}
|
||||
if(uni.getStorageSync("table_code")){
|
||||
data.table.tableCode = uni.getStorageSync("table_code")
|
||||
}
|
||||
init()
|
||||
xiadanClick()
|
||||
})
|
||||
|
|
@ -273,7 +276,7 @@
|
|||
$category = categoryRes.records
|
||||
// 获取商品数据
|
||||
const goodsRes = await getGoods()
|
||||
const goods = goodsRes.records.filter((v) => {
|
||||
const goods = goodsRes.filter((v) => {
|
||||
let isShow = true;
|
||||
if (v.type != "sku") {
|
||||
isShow = v.skuList.length >= 1;
|
||||
|
|
@ -326,23 +329,28 @@
|
|||
cars.length = 0
|
||||
data.isCars = true;
|
||||
console.log("购物车信息onboc_init===",msg)
|
||||
if( !data.table.tableCode ){
|
||||
data.table.tableCode = msg.table_code
|
||||
uni.setStorageSync("table_code",msg.table_code)
|
||||
}
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,cartArr)
|
||||
cartControls(cartItem,'add')
|
||||
})
|
||||
|
||||
uni.hideLoading()
|
||||
break;
|
||||
case 'onboc_add':
|
||||
case 'add':
|
||||
cartItem = getNowCart(msg.data,cartArr)
|
||||
cartControls(cartItem,'add')
|
||||
infoBox.showToast('添加成功')
|
||||
infoBox.showToast('操作成功')
|
||||
break;
|
||||
case 'onboc_edit':
|
||||
case 'edit':
|
||||
cartItem = getNowCart(msg.data,cartArr)
|
||||
cartControls(cartItem,'edit')
|
||||
infoBox.showToast('添加成功')
|
||||
infoBox.showToast('操作成功')
|
||||
break;
|
||||
case 'onboc_del':
|
||||
case 'del':
|
||||
|
|
@ -390,6 +398,7 @@
|
|||
*/
|
||||
function editCart (par,operate_type) {
|
||||
console.log('购物车添加菜品',par)
|
||||
console.log("data.table==",data.table)
|
||||
if( !data.isGoodsAdd ){ return; }
|
||||
let params = {
|
||||
...data.socketData,
|
||||
|
|
@ -437,10 +446,7 @@
|
|||
*/
|
||||
function getGoods() {
|
||||
const showLoading = data.tabbar.length <= 0 ? true : false
|
||||
return getProductList({
|
||||
page: 1,
|
||||
size: 300
|
||||
},'product', showLoading)
|
||||
return getProductList({},'product', showLoading)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -511,8 +517,9 @@
|
|||
}
|
||||
if( cars.length > 0){
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
} else{
|
||||
initCart()
|
||||
}
|
||||
// initCart()
|
||||
return;
|
||||
}
|
||||
if (item.status == "unbind") {
|
||||
|
|
@ -569,7 +576,7 @@
|
|||
}
|
||||
|
||||
// 不影响之前的代码 称重number单独处理
|
||||
if ($goods.type == 'weigh' && showCurrentInput) {
|
||||
if ($goods.type == 'weight' && showCurrentInput) {
|
||||
number = cartItem.number * 1 + Number(showCurrentInput)
|
||||
}
|
||||
|
||||
|
|
@ -583,7 +590,7 @@
|
|||
setSearchGoods(searchGoodsIndex, number)
|
||||
} else {
|
||||
// 不影响之前的代码 称重suit单独处理
|
||||
if ($goods.type == 'weigh' && showCurrentInput) {
|
||||
if ($goods.type == 'weight' && showCurrentInput) {
|
||||
suitNum = showCurrentInput
|
||||
}
|
||||
// 套餐和单规格
|
||||
|
|
@ -652,22 +659,32 @@
|
|||
if( !data.isGoodsAdd ){ return; }
|
||||
let $sku;
|
||||
let $goods;
|
||||
data.tabbar.map(tabbarItem=>{
|
||||
if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){
|
||||
$goods = !e.goods.product_id ? undefined : tabbarItem.foods.find(v => v.id == e.goods.product_id)
|
||||
|
||||
if( e.goods.is_temporary != 1){
|
||||
data.tabbar.map(tabbarItem=>{
|
||||
if(tabbarItem.foods.find(v => v.id == e.goods.product_id)){
|
||||
$goods = !e.goods.product_id ? undefined : tabbarItem.foods.find(v => v.id == e.goods.product_id)
|
||||
}
|
||||
})
|
||||
if( $goods.type != 'package'){
|
||||
//临时菜没有skuList
|
||||
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
|
||||
} else {
|
||||
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
|
||||
}
|
||||
if (e.num === 0 || e.num < $sku.suitNum) {
|
||||
//移除
|
||||
delCart(e.goods.id)
|
||||
return
|
||||
}
|
||||
})
|
||||
if( $goods.type != 'package'){
|
||||
//临时菜没有skuList
|
||||
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
|
||||
} else {
|
||||
$sku = !e.goods.product_id ? { suitNum: 1 } : $goods.skuList.find(v => v.id == e.goods.sku_id)
|
||||
}
|
||||
if (e.num === 0 || e.num < $sku.suitNum) {
|
||||
//移除
|
||||
delCart(e.goods.id)
|
||||
return
|
||||
if (e.num === 0) {
|
||||
//移除
|
||||
delCart(e.goods.id)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
editCart({
|
||||
number: e.num,
|
||||
id: e.goods.id,
|
||||
|
|
@ -684,44 +701,14 @@
|
|||
*/
|
||||
async function taocanConfirm(d, item) {
|
||||
console.log(d)
|
||||
let carGoods = null;
|
||||
cars.some(item=>{
|
||||
if(item.product_id == data.goodsData.id){
|
||||
let arr = []
|
||||
JSON.parse(item.pro_group_info).some((v,i)=>{
|
||||
if( JSON.stringify(v.selectData) == JSON.stringify(d[i].selectData) ){
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
if( arr.length == d.length ) {
|
||||
carGoods = item
|
||||
return carGoods;
|
||||
}
|
||||
}
|
||||
})
|
||||
if (carGoods) {
|
||||
//更新
|
||||
let newNumber = carGoods.number * 1 + 1
|
||||
editCart({
|
||||
id: carGoods.id,
|
||||
number: newNumber,
|
||||
product_id: carGoods.product_id,
|
||||
sku_id: carGoods.sku_id,
|
||||
},'edit')
|
||||
data.isGoodsAdd = false;
|
||||
} else {
|
||||
//添加
|
||||
editCart({
|
||||
number: item.skuList[0].suitNum,
|
||||
product_id: item.id,
|
||||
sku_id: item.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(d),
|
||||
},'add')
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//添加
|
||||
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();
|
||||
|
|
@ -1310,7 +1297,7 @@
|
|||
uni.$on('add:cashCai', async (data) => {
|
||||
console.log('add:cashCai',data);
|
||||
$originGoods.push(data)
|
||||
|
||||
data.isGoodsAdd = false;
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="isTui(item)">
|
||||
{{item.status=='refunding'?'退款中':'已退'}}
|
||||
{{item.status=='part_refund'?'部分已退':'全部已退'}}
|
||||
</view>
|
||||
<view
|
||||
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount*item.returnNum}}</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnAmount*item.refundNum}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
|
|
@ -70,8 +70,8 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
<template v-if="isTui(item)">
|
||||
<view>¥0.00</view>
|
||||
<template v-if="item.refundNum>0">
|
||||
<view>¥{{(returnTotalMoney(item)-item.refundNum*item.returnAmount).toFixed(2)}}</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="item.userCouponId">
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
import goodsList from './components/list.vue';
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@
|
|||
<view class="no-wrap u-m-r-32">打包费</view>
|
||||
<view>¥{{data.packFee||0}}</view>
|
||||
</view>
|
||||
<view style="height: 32rpx;" v-if="data.packFee>0&&data.seatInfo&&data.seatInfo.priceAmount>0"></view>
|
||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view style="height: 32rpx;" ></view>
|
||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
})
|
||||
onShow(init)
|
||||
onPullDownRefresh(()=>{
|
||||
pageData.page = 1
|
||||
pageData.query.page = 1
|
||||
init()
|
||||
})
|
||||
watch(()=>pageData.createdAt,(newval)=>{
|
||||
|
|
@ -107,7 +107,8 @@
|
|||
* @param {Object} e
|
||||
*/
|
||||
function pageChange(e){
|
||||
pageData.page = e
|
||||
pageData.query.page = e
|
||||
console.log(e)
|
||||
init()
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +119,7 @@
|
|||
*/
|
||||
function updateQuery(key,e){
|
||||
pageData.query[key] = e
|
||||
pageData.page = 1
|
||||
pageData.query.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +127,7 @@
|
|||
* 搜索监听
|
||||
*/
|
||||
function searchConfirm(){
|
||||
pageData.page = 1
|
||||
pageData.query.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -373,7 +373,8 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
pageData.seatNum = order.tableId!=null&&order.tableId!="undefined" ? order.seatNum : 0;
|
||||
console.log("order==",order)
|
||||
pageData.seatNum = order.seatNum;
|
||||
}
|
||||
const coupAllPrice = computed(() => {
|
||||
const n = pays.quan.reduce((prve, cur) => {
|
||||
|
|
@ -429,7 +430,7 @@
|
|||
const discountSaleAmount = computed(() => {
|
||||
if(pageData.goodsList){
|
||||
let price = pageData.goodsList.filter(v => v.discountSaleAmount > 0 && v.status !== "return").reduce((a, b) => {
|
||||
return a + (b.num * b.discountSaleAmount)
|
||||
return a + ((b.num * b.price) - (b.num * b.discountSaleAmount))
|
||||
}, 0)
|
||||
return price
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,11 +194,12 @@
|
|||
if (!noteResult) {
|
||||
return infoBox.showToast('请输入或选择退款原因!')
|
||||
}
|
||||
let refundAmount = orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + (cur.number * 1 * cur.unitPrice)
|
||||
}, 0)
|
||||
let params = {
|
||||
orderId: option.orderId,
|
||||
refundAmount: orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + (cur.number * 1 * cur.unitPrice)
|
||||
}, 0),
|
||||
refundAmount: refundAmount.toFixed(2),
|
||||
refundReason: noteResult,
|
||||
refundDetails: orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue