This commit is contained in:
weipengfei 2024-06-08 19:02:02 +08:00
parent 8ead6c2002
commit b375b44d45
43 changed files with 1558 additions and 2336 deletions

View File

@ -1,7 +1,7 @@
VITE_NOW_TYPE = 'dist' VITE_NOW_TYPE = 'dist'
# VITE_PUSH_URL = 'ws://192.168.1.22:8787' VITE_PUSH_URL = 'ws://192.168.1.22:8787'
# VITE_BASE_URL = 'http://192.168.1.22:8546' VITE_BASE_URL = 'http://192.168.1.22:8545'
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull' # VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
VITE_BASE_URL = 'https://erp.lihaink.cn' # VITE_BASE_URL = 'https://test-multi-store.lihaink.cn'

View File

@ -1,4 +1,4 @@
VITE_NOW_TYPE = 'build' VITE_NOW_TYPE = 'build'
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull' VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
VITE_BASE_URL = 'https://erp.lihaink.cn' VITE_BASE_URL = 'https://test-multi-store.lihaink.cn'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{h as S,i as Y}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as w,u as P,r as o,b as h,j as k,q as N,c as f,h as b,e as t,t as d,s as D,f as r,w as x,g as F,v as M,x as V,A as j}from"./index-3-t8Fk7s.js";import{h as n}from"./moment-Cl4UOzQZ.js";const v=l=>(M("data-v-266c9d86"),l=l(),V(),l),q={"element-loading-text":"加载中",class:"my-order"},A={key:0,class:"from"},B={class:"form-card"},L=v(()=>t("div",{class:"tips"},"今日收银 平台+线上+现金 总金额",-1)),T={class:"form-card"},O=v(()=>t("div",{class:"tips"},"昨日收银 平台+线上+现金 总金额",-1)),E={class:"form-card"},R=v(()=>t("div",{class:"tips"},"本月收银 平台+线上+现金 总金额",-1)),U={class:"table"},z={__name:"indexCount",setup(l){const c=P(),m=o([]),g=j();o(1),o(null);const C=o({page:1,limit:15,staff_id:c.userInfo.service.service_id}),_=o(!1);o(0),(()=>{S(c.userInfo.service.mer_id,C.value).then(s=>{m.value=s.data})})();const a=o({});(()=>{_.value=!0,Y(c.userInfo.service.mer_id,{staff_id:c.userInfo.service.service_id}).then(s=>{a.value=s.data.data,_.value=!1})})();const I=(s,p)=>{let e="",i={};Number(n(s.day).format("MM"))>Number(n().format("MM"))?e=n().format("YYYY")-1+"-"+s.day.split("-").join("-"):e=n().format("YYYY")+"-"+s.day.split("-").join("-"),i.date=e,p.no==2&&(i.payType=1),p.no==3&&(i.payType=2),g.push({path:"order",query:i})};return(s,p)=>{const e=h("el-table-column"),i=h("el-table"),u=k("loading");return N((f(),b("div",q,[a.value.today?(f(),b("div",A,[t("div",B,[t("div",null,d((a.value.today.cashPayment+a.value.today.payPrice).toFixed(2)),1),L]),t("div",T,[t("div",null,d((a.value.yesterday.cashPayment+a.value.yesterday.payPrice).toFixed(2)),1),O]),t("div",E,[t("div",null,d((a.value.month.cashPayment+a.value.month.payPrice).toFixed(2)),1),R])])):D("",!0),t("div",U,[r(i,{data:m.value,style:{width:"100%"},onCellClick:I},{default:x(()=>[r(e,{prop:"day",label:"日期",width:"260"}),r(e,{prop:"total",label:"订单数量"}),r(e,{prop:"cash_payment",label:"现金收银金额"}),r(e,{prop:"cash_registe",label:"线上收银金额"}),r(e,{prop:"pay_price",label:"平台交易额"}),r(e,{label:"总金额"},{default:x(y=>[F(d(((+y.row.pay_price||0)+(+y.row.cash_payment||0)).toFixed(2)),1)]),_:1})]),_:1},8,["data"])])])),[[u,_.value]])}}},W=w(z,[["__scopeId","data-v-266c9d86"]]);export{W as default}; import{h as S,i as Y}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as w,u as P,r as o,b as h,j as k,q as N,c as f,h as b,e as t,t as d,s as D,f as r,w as x,g as F,v as M,x as V,A as j}from"./index-3-t8Fk7s.js";import{h as n}from"./moment-Cl4UOzQZ.js";const v=l=>(M("data-v-266c9d86"),l=l(),V(),l),q={"element-loading-text":"加载中",class:"my-order"},A={key:0,class:"from"},B={class:"form-card"},L=v(()=>t("div",{class:"tips"},"今日收银 平台+线上+现金 总金额",-1)),T={class:"form-card"},O=v(()=>t("div",{class:"tips"},"昨日收银 平台+线上+现金 总金额",-1)),E={class:"form-card"},R=v(()=>t("div",{class:"tips"},"本月收银 平台+线上+现金 总金额",-1)),U={class:"table"},z={__name:"indexCount",setup(l){const c=P(),m=o([]),g=j();o(1),o(null);const C=o({page:1,limit:15,staff_id:c.userInfo.service.service_id}),_=o(!1);o(0),(()=>{S(c.userInfo.service.store_id,C.value).then(s=>{m.value=s.data})})();const a=o({});(()=>{_.value=!0,Y(c.userInfo.service.store_id,{staff_id:c.userInfo.service.service_id}).then(s=>{a.value=s.data.data,_.value=!1})})();const I=(s,p)=>{let e="",i={};Number(n(s.day).format("MM"))>Number(n().format("MM"))?e=n().format("YYYY")-1+"-"+s.day.split("-").join("-"):e=n().format("YYYY")+"-"+s.day.split("-").join("-"),i.date=e,p.no==2&&(i.payType=1),p.no==3&&(i.payType=2),g.push({path:"order",query:i})};return(s,p)=>{const e=h("el-table-column"),i=h("el-table"),u=k("loading");return N((f(),b("div",q,[a.value.today?(f(),b("div",A,[t("div",B,[t("div",null,d((a.value.today.cashPayment+a.value.today.payPrice).toFixed(2)),1),L]),t("div",T,[t("div",null,d((a.value.yesterday.cashPayment+a.value.yesterday.payPrice).toFixed(2)),1),O]),t("div",E,[t("div",null,d((a.value.month.cashPayment+a.value.month.payPrice).toFixed(2)),1),R])])):D("",!0),t("div",U,[r(i,{data:m.value,style:{width:"100%"},onCellClick:I},{default:x(()=>[r(e,{prop:"day",label:"日期",width:"260"}),r(e,{prop:"total",label:"订单数量"}),r(e,{prop:"cash_payment",label:"现金收银金额"}),r(e,{prop:"cash_registe",label:"线上收银金额"}),r(e,{prop:"pay_price",label:"平台交易额"}),r(e,{label:"总金额"},{default:x(y=>[F(d(((+y.row.pay_price||0)+(+y.row.cash_payment||0)).toFixed(2)),1)]),_:1})]),_:1},8,["data"])])])),[[u,_.value]])}}},W=w(z,[["__scopeId","data-v-266c9d86"]]);export{W as default};

View File

@ -1 +1 @@
import{e as F,a as G,g as J,f as K}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as Q,u as W,r as s,b as d,j as X,q as Y,c,h as m,f as t,w as o,g as r,t as Z,e as P,d as I,A as ee,E as h,v as te,x as ae}from"./index-3-t8Fk7s.js";import{p as oe}from"./pay-Bt7FIL7i.js";const le=v=>(te("data-v-3c901223"),v=v(),ae(),v),se={"element-loading-text":"加载中",class:"my-order"},ne={key:0},re={key:1,style:{color:"#ff4a00"}},ie={key:0},de={key:1,class:"flex"},ce=le(()=>P("span",null,"提单前请清空购物车, 避免提单的商品与购物车商品混合, 请确保购物车内无数据后再进行提单",-1)),ue={class:"dialog-footer"},pe={__name:"indexList",setup(v){const k=W(),C=s([]),b=ee(),g=s(1),f=s(null),n=s({page:1,limit:20}),y=s(!1),w=s(0),i=()=>{y.value=!0,g.value==1&&(n.value.paid=null),g.value==2&&(n.value.paid=0),F(k.userInfo.service.mer_id,n.value).then(e=>{C.value=e.data.list,w.value=e.data.count,y.value=!1})};i();const x=s(0);(()=>{G({staff_id:k.userInfo.service.service_id}).then(e=>{var a;x.value=(a=e.data.list)==null?void 0:a.length})})();const A=e=>{n.value.page=1,i()},B=e=>{n.value.page=e,i()},D=e=>{n.value.page=e,i()},N=e=>{n.value.page=e,i()},R=()=>{i()},$=e=>{f.value.setRePay({price:e.pay_price,order_id:e.group_order_id}),f.value.drawer=!0},E=e=>{J({order_sn:e}).then(a=>{a.data.paid==1||a.message=="支付成功"?(h({message:a.message,type:"success"}),i()):h({message:a.message,type:"error"})}).catch(a=>{})},L=s(""),U=()=>{_.value=!1,K({order_sn:L.value}).then(e=>{h({message:e.message,type:"success"}),b.push({name:"home"})})},_=s(!1),z=e=>{L.value=e,_.value=!0},O=()=>{b.push({name:"home"})};return(e,a)=>{const S=d("el-radio-button"),T=d("el-radio-group"),u=d("el-table-column"),p=d("el-button"),j=d("el-table"),q=d("el-pagination"),H=d("el-dialog"),M=X("loading");return Y((c(),m("div",se,[t(T,{modelValue:g.value,"onUpdate:modelValue":a[0]||(a[0]=l=>g.value=l),style:{"margin-bottom":"30px"},onChange:A},{default:o(()=>[t(S,{value:1},{default:o(()=>[r("全部")]),_:1}),t(S,{value:2},{default:o(()=>[r("未支付")]),_:1})]),_:1},8,["modelValue"]),t(j,{data:C.value,style:{width:"100%"}},{default:o(()=>[t(u,{prop:"group_order_id",label:"ID",width:"100"}),t(u,{prop:"order_sn",label:"订单号",width:"260"}),t(u,{prop:"total_price",label:"订单金额"}),t(u,{prop:"paid",label:"支付状态"},{default:o(l=>[l.row.paid==1?(c(),m("span",ne,"已支付")):(c(),m("span",re,"未支付"))]),_:1}),t(u,{prop:"create_time",label:"订单创建时间"}),t(u,{prop:"pay_time",label:"订单支付时间"},{default:o(l=>[l.row.pay_time?(c(),m("span",ie,Z(l.row.pay_time),1)):(c(),m("div",de,[t(p,{type:"primary",link:"",onClick:V=>$(l.row)},{default:o(()=>[r("重新支付")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>E(l.row.order_sn)},{default:o(()=>[r("检测状态")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>z(l.row.order_sn)},{default:o(()=>[r("提单")]),_:2},1032,["onClick"])]))]),_:1})]),_:1},8,["data"]),t(q,{"page-size":n.value.limit,layout:"prev, pager, next",total:w.value,onPrevClick:B,onNextClick:D,onCurrentChange:N},null,8,["page-size","total"]),t(oe,{ref_key:"payRef",ref:f,onPaySuccess:R},null,512),t(H,{modelValue:_.value,"onUpdate:modelValue":a[2]||(a[2]=l=>_.value=l),title:"提示",width:"500"},{footer:o(()=>[P("div",ue,[t(p,{onClick:a[1]||(a[1]=l=>_.value=!1)},{default:o(()=>[r("取消")]),_:1}),x.value>0?(c(),I(p,{key:0,onClick:O},{default:o(()=>[r(" 前去清空购物车 ")]),_:1})):(c(),I(p,{key:1,type:"primary",onClick:U},{default:o(()=>[r(" 确认提单 ")]),_:1}))])]),default:o(()=>[ce]),_:1},8,["modelValue"])])),[[M,y.value]])}}},fe=Q(pe,[["__scopeId","data-v-3c901223"]]);export{fe as default}; import{e as F,a as G,g as J,f as K}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-BaAcCNPN.js";import{_ as Q,u as W,r as s,b as d,j as X,q as Y,c,h as m,f as t,w as o,g as r,t as Z,e as P,d as I,A as ee,E as h,v as te,x as ae}from"./index-3-t8Fk7s.js";import{p as oe}from"./pay-Bt7FIL7i.js";const le=v=>(te("data-v-3c901223"),v=v(),ae(),v),se={"element-loading-text":"加载中",class:"my-order"},ne={key:0},re={key:1,style:{color:"#ff4a00"}},ie={key:0},de={key:1,class:"flex"},ce=le(()=>P("span",null,"提单前请清空购物车, 避免提单的商品与购物车商品混合, 请确保购物车内无数据后再进行提单",-1)),ue={class:"dialog-footer"},pe={__name:"indexList",setup(v){const k=W(),C=s([]),b=ee(),g=s(1),f=s(null),n=s({page:1,limit:20}),y=s(!1),w=s(0),i=()=>{y.value=!0,g.value==1&&(n.value.paid=null),g.value==2&&(n.value.paid=0),F(k.userInfo.service.store_id,n.value).then(e=>{C.value=e.data.list,w.value=e.data.count,y.value=!1})};i();const x=s(0);(()=>{G({staff_id:k.userInfo.service.service_id}).then(e=>{var a;x.value=(a=e.data.list)==null?void 0:a.length})})();const A=e=>{n.value.page=1,i()},B=e=>{n.value.page=e,i()},D=e=>{n.value.page=e,i()},N=e=>{n.value.page=e,i()},R=()=>{i()},$=e=>{f.value.setRePay({price:e.pay_price,order_id:e.group_order_id}),f.value.drawer=!0},E=e=>{J({order_sn:e}).then(a=>{a.data.paid==1||a.message=="支付成功"?(h({message:a.message,type:"success"}),i()):h({message:a.message,type:"error"})}).catch(a=>{})},L=s(""),U=()=>{_.value=!1,K({order_sn:L.value}).then(e=>{h({message:e.message,type:"success"}),b.push({name:"home"})})},_=s(!1),z=e=>{L.value=e,_.value=!0},O=()=>{b.push({name:"home"})};return(e,a)=>{const S=d("el-radio-button"),T=d("el-radio-group"),u=d("el-table-column"),p=d("el-button"),j=d("el-table"),q=d("el-pagination"),H=d("el-dialog"),M=X("loading");return Y((c(),m("div",se,[t(T,{modelValue:g.value,"onUpdate:modelValue":a[0]||(a[0]=l=>g.value=l),style:{"margin-bottom":"30px"},onChange:A},{default:o(()=>[t(S,{value:1},{default:o(()=>[r("全部")]),_:1}),t(S,{value:2},{default:o(()=>[r("未支付")]),_:1})]),_:1},8,["modelValue"]),t(j,{data:C.value,style:{width:"100%"}},{default:o(()=>[t(u,{prop:"group_order_id",label:"ID",width:"100"}),t(u,{prop:"order_sn",label:"订单号",width:"260"}),t(u,{prop:"total_price",label:"订单金额"}),t(u,{prop:"paid",label:"支付状态"},{default:o(l=>[l.row.paid==1?(c(),m("span",ne,"已支付")):(c(),m("span",re,"未支付"))]),_:1}),t(u,{prop:"create_time",label:"订单创建时间"}),t(u,{prop:"pay_time",label:"订单支付时间"},{default:o(l=>[l.row.pay_time?(c(),m("span",ie,Z(l.row.pay_time),1)):(c(),m("div",de,[t(p,{type:"primary",link:"",onClick:V=>$(l.row)},{default:o(()=>[r("重新支付")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>E(l.row.order_sn)},{default:o(()=>[r("检测状态")]),_:2},1032,["onClick"]),t(p,{type:"primary",link:"",onClick:V=>z(l.row.order_sn)},{default:o(()=>[r("提单")]),_:2},1032,["onClick"])]))]),_:1})]),_:1},8,["data"]),t(q,{"page-size":n.value.limit,layout:"prev, pager, next",total:w.value,onPrevClick:B,onNextClick:D,onCurrentChange:N},null,8,["page-size","total"]),t(oe,{ref_key:"payRef",ref:f,onPaySuccess:R},null,512),t(H,{modelValue:_.value,"onUpdate:modelValue":a[2]||(a[2]=l=>_.value=l),title:"提示",width:"500"},{footer:o(()=>[P("div",ue,[t(p,{onClick:a[1]||(a[1]=l=>_.value=!1)},{default:o(()=>[r("取消")]),_:1}),x.value>0?(c(),I(p,{key:0,onClick:O},{default:o(()=>[r(" 前去清空购物车 ")]),_:1})):(c(),I(p,{key:1,type:"primary",onClick:U},{default:o(()=>[r(" 确认提单 ")]),_:1}))])]),default:o(()=>[ce]),_:1},8,["modelValue"])])),[[M,y.value]])}}},fe=Q(pe,[["__scopeId","data-v-3c901223"]]);export{fe as default};

View File

@ -31,43 +31,43 @@ export function productTitleApi(id, data) {
/** /**
* @description 上下架 * @description 上下架
*/ */
export function productStatusApi(mer_id, id, data) { export function productStatusApi(store_id, id, data) {
return request.post(`server/${mer_id}/product/status/${id}`, data) return request.post(`server/${store_id}/product/status/${id}`, data)
} }
/** /**
* @description 平台分类 * @description 平台分类
*/ */
export function categoryListApi(mer_id, data) { export function categoryListApi(store_id, data) {
return request.get(`server/${mer_id}/category/list`, { params: data }) return request.get(`server/${store_id}/category/list`, { params: data })
} }
/** /**
* @description 添加商品 * @description 添加商品
*/ */
export function productCreateApi(mer_id, data) { export function productCreateApi(store_id, data) {
return request.post(`server/${mer_id}/product/create`, data) return request.post(`server/${store_id}/product/create`, data)
} }
/** /**
* @description 编辑商品 * @description 编辑商品
*/ */
export function productUpdateApi(mer_id, id, data) { export function productUpdateApi(store_id, id, data) {
return request.post(`server/${mer_id}/product/update/${id}`, data) return request.post(`server/${store_id}/product/update/${id}`, data)
} }
/** /**
* @description 商品详情 * @description 商品详情
*/ */
export function productDetailApi(mer_id, id, data) { export function productDetailApi(store_id, id, data) {
return request.get(`server/${mer_id}/product/detail/${id}`, { params: data }) return request.get(`server/${store_id}/product/detail/${id}`, { params: data })
} }
/** /**
* @description 批发商品列表 * @description 批发商品列表
*/ */
export function saleStoreListApi(data) { export function saleStoreListApi(data) {
return request.get(`/goods/goods/mer_list`, { params: data }) return request.get(`/store_product/storeProduct/lists`, { params: data })
} }
/** /**

View File

@ -4,14 +4,14 @@ import request from '@/utils/axios.js'
* @description 加入购物车 * @description 加入购物车
*/ */
export function cartCreateApi(data) { export function cartCreateApi(data) {
return request.post(`/order/cart/create`, data) return request.post(`/cart/cart/create`, data)
} }
/** /**
* @description 购物列表 * @description 购物列表
*/ */
export function cartListApi(data) { export function cartListApi(data) {
return request.get(`/order/cart/list`, { params: data }) return request.get(`/cart/cart/list`, { params: data })
} }
/** /**
@ -26,21 +26,21 @@ export function cartChangeApi(id, data) {
* @description 结算 * @description 结算
*/ */
export function orderCheckApi(data) { export function orderCheckApi(data) {
return request.post(`/order/RetailOrder/checkOrder`, data) return request.post(`/store_order/StoreOrder/checkOrder`, data)
} }
/** /**
* @description 删除商品 * @description 删除商品
*/ */
export function cartDeleteApi(data) { export function cartDeleteApi(data) {
return request.post(`/order/cart/delete`, data) return request.post(`/cart/cart/delete`, data)
} }
/** /**
* @description 支付 * @description 支付
*/ */
export function orderCreateApi(data) { export function orderCreateApi(data) {
return request.post(`/order/RetailOrder/createOrder`, data) return request.post(`/store_order/StoreOrder/createOrder`, data)
} }
/** /**
@ -67,8 +67,8 @@ export function orderListApi(data) {
/** /**
* @description 核销订单列表 * @description 核销订单列表
*/ */
export function verifierOrderListApi(id, code) { export function verifierOrderListApi(data) {
return request.get(`verifier/${id}/order/${code}`) return request.get(`verifier/order`, { params: data })
} }
/** /**
@ -88,22 +88,22 @@ export function orderLadingApi(data) {
/** /**
* @description 核销 * @description 核销
*/ */
export function verifierApi(mer_id, id, data) { export function verifierApi(store_id, id, data) {
return request.post(`verifier/${mer_id}/${id}`, data) return request.post(`verifier/${store_id}/${id}`, data)
} }
/** /**
* @description 统计 * @description 统计
*/ */
export function statisticsApi(mer_id, data) { export function statisticsApi(store_id, data) {
return request.get(`admin/${mer_id}/statistics`, { params: data }) return request.get(`admin/${store_id}/statistics`, { params: data })
} }
/** /**
* @description 统计列表 * @description 统计列表
*/ */
export function orderPriceApi(mer_id, data) { export function orderPriceApi(store_id, data) {
return request.get(`admin/${mer_id}/order_price`, { params: data }) return request.get(`admin/${store_id}/order_price`, { params: data })
} }
@ -111,7 +111,7 @@ export function orderPriceApi(mer_id, data) {
* @description 收银订单列表 * @description 收银订单列表
*/ */
export function saleOrderListApi(data) { export function saleOrderListApi(data) {
return request.get(`/order/retailOrder/order_list`, { params: data }) return request.get(`/store_order/StoreOrder/lists`, { params: data })
} }
/** /**
@ -128,6 +128,20 @@ export function cashierinfoListApi(data) {
return request.get(`/order/cashierinfo/lists`, { params: data }) return request.get(`/order/cashierinfo/lists`, { params: data })
} }
/**
* @description 订单详情
*/
export function cashierinfoDetailsApi(data) {
return request.get(`/store_order/storeOrder/detail`, { params: data })
}
/**
* @description 订单核销
*/
export function writeoffOrderApi(data) {
return request.post(`/store_order/StoreOrder/writeoff_order`, data)
}
/** /**
* @description 商户给用户添加地址 * @description 商户给用户添加地址
*/ */

View File

@ -97,7 +97,6 @@ const handleEnter = () => {
return ElMessage.error("请输入正确的支付码"); return ElMessage.error("请输入正确的支付码");
} }
orderCreateApi({ orderCreateApi({
address_id: "",
key: form.value.key, key: form.value.key,
cart_id: cart_id.value, cart_id: cart_id.value,
pay_type: pay_type, pay_type: pay_type,
@ -320,7 +319,6 @@ const cashBnt = () => {
if (order_id.value) orderPay(order_id.value); if (order_id.value) orderPay(order_id.value);
else else
orderCreateApi({ orderCreateApi({
address_id: "",
cart_id: cart_id.value, cart_id: cart_id.value,
pay_type: "17", // 17 pay_type: "17", // 17
}) })
@ -457,7 +455,7 @@ onUnmounted(() => {
</div> </div>
<div style="color: #999; padding: 2rem 0 0.3rem 0">应收金额():</div> <div style="color: #999; padding: 2rem 0 0.3rem 0">应收金额():</div>
<div style="color: #f5222d; padding-bottom: 2rem"> <div style="color: #f5222d; padding-bottom: 2rem">
¥<span style="font-size: 1.6rem">{{ form.total }}</span> ¥<span style="font-size: 1.6rem">{{ form.pay_price }}</span>
</div> </div>
<div <div
v-loading="loading" v-loading="loading"

View File

@ -1,6 +1,6 @@
const config = { const config = {
url: import.meta.env.VITE_BASE_URL + '/api', url: import.meta.env.VITE_BASE_URL + '/store',
upload: import.meta.env.VITE_BASE_URL + '/api/upload/image/field', upload: import.meta.env.VITE_BASE_URL + '/store/upload/image/field',
} }
export default config; export default config;

View File

@ -13,7 +13,7 @@ const connection = new Push({
}); });
// user-1 // user-1
const user_channel = connection.subscribe(`store_merchant_${userStore.userInfo.merchant.mer_id}`); const user_channel = connection.subscribe(`store_merchant_${userStore.userInfo.store_id}`);
// const user_channel = connection.subscribe(`store_merchant_${1}`); // const user_channel = connection.subscribe(`store_merchant_${1}`);
// user-2message // user-2message
@ -26,6 +26,9 @@ user_channel.on('message', function (data) {
if(data?.content?.type=='store_merchant'&&data?.content?.msg=="您有一笔新的订单"){ if(data?.content?.type=='store_merchant'&&data?.content?.msg=="您有一笔新的订单"){
mitt.emit('new_order', data?.content); mitt.emit('new_order', data?.content);
} }
if(data?.content?.type=='platform_print'){
mitt.emit('platform_print', data?.content?.data);
}
} catch (error) { } catch (error) {
} }

View File

@ -16,16 +16,17 @@ const orderStore = useOrderStore();
const setOrderCount = (e = 1) => { const setOrderCount = (e = 1) => {
orderStore.setOrderCount(e) orderStore.setOrderCount(e)
list.value.forEach(item=>{ list.value.forEach(item => {
if(item.name == "order") item.count = e; if (item.name == "order") item.count = e;
}) })
}; };
let isPlaying = false; let isPlaying = false;
const newOrder = (e) => { const newOrder = (e) => {
merchantOrderCountApi().then((res) => { // merchantOrderCountApi().then((res) => {
setOrderCount(res?.data?.order_count || 0); // setOrderCount(res?.data?.order_count || 0);
}); // });
setOrderCount(0);
ElMessage.success('您有新的订单'); ElMessage.success('您有新的订单');
if (isPlaying) return; // if (isPlaying) return; //
// //
@ -34,16 +35,16 @@ const newOrder = (e) => {
audio.play(); audio.play();
isPlaying = true; isPlaying = true;
// ended // ended
audio.addEventListener('ended', function() { audio.addEventListener('ended', function () {
isPlaying = false; isPlaying = false;
}); });
}; };
setTimeout(() => { // setTimeout(() => {
newOrder({ // newOrder({
msg: "您有一笔新的订单", // msg: "",
}); // });
}, 2000); // }, 2000);
const navTo = (name) => { const navTo = (name) => {
router.push({ name }); router.push({ name });
@ -53,13 +54,19 @@ const list = ref([
{ name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 }, { name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 },
{ {
name: "order", name: "order",
title: "摊贩订单", title: "线上订单",
ico: "DataAnalysis", ico: "DataAnalysis",
count: +orderStore.orderCount, count: 0,
}, },
{ name: "purchaseOrder", title: "采购订单", ico: "Van", count: 0 }, {
{ name: "orderCount", title: "订单统计", ico: "DocumentRemove", count: 0 }, name: "convert",
{ name: "wallet", title: "余额提现", ico: "Wallet", count: 0 }, title: "订单核销",
ico: "FullScreen",
count: 0,
},
// { name: "purchaseOrder", title: "", ico: "Van", count: 0 },
// { name: "orderCount", title: "", ico: "DocumentRemove", count: 0 },
// { name: "wallet", title: "", ico: "Wallet", count: 0 },
// { name: "test", title: "", ico: "Tickets", count: 0 }, // { name: "test", title: "", ico: "Tickets", count: 0 },
]); ]);
const aup = () => { const aup = () => {
@ -76,12 +83,13 @@ onMounted(() => {
mitt.on("up", aup); mitt.on("up", aup);
mitt.on("down", adown); mitt.on("down", adown);
mitt.on("new_order", newOrder); mitt.on("new_order", newOrder);
mitt.on("set-order-count-zero", ()=>{ mitt.on("set-order-count-zero", () => {
setOrderCount(0); setOrderCount(0);
}); });
merchantOrderCountApi().then((res) => { // merchantOrderCountApi().then((res) => {
setOrderCount(res?.data?.order_count || 0); // setOrderCount(res?.data?.order_count || 0);
}); // });
setOrderCount(0)
}); });
onUnmounted(() => { onUnmounted(() => {
@ -94,13 +102,8 @@ onUnmounted(() => {
<template> <template>
<div class="my-card"> <div class="my-card">
<div <div v-for="item in list" :key="item.name" class="list-item" :class="{ active: route.name == item.name }"
v-for="item in list" @click="navTo(item.name)">
:key="item.name"
class="list-item"
:class="{ active: route.name == item.name }"
@click="navTo(item.name)"
>
<el-icon size="2rem"> <el-icon size="2rem">
<component :is="item.ico" /> <component :is="item.ico" />
</el-icon> </el-icon>
@ -119,6 +122,7 @@ onUnmounted(() => {
align-items: center; align-items: center;
padding-top: 1.5rem; padding-top: 1.5rem;
overflow: auto; overflow: auto;
.list-item { .list-item {
width: 4.5rem; width: 4.5rem;
height: 4.5rem; height: 4.5rem;
@ -135,6 +139,7 @@ onUnmounted(() => {
background-color: #1890ff; background-color: #1890ff;
transition: 300ms; transition: 300ms;
} }
.badge { .badge {
position: absolute; position: absolute;
top: -0.5rem; top: -0.5rem;
@ -146,25 +151,31 @@ onUnmounted(() => {
} }
} }
} }
/* 修改滚动条的样式 */ /* 修改滚动条的样式 */
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; /* 隐藏滚动条 */ display: none;
/* 隐藏滚动条 */
} }
/* 设置滚动条的轨道样式 */ /* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */ background-color: #f1f1f1;
/* 设置轨道的背景色 */
margin: 1.25rem 0; margin: 1.25rem 0;
} }
/* 设置滚动条的滑块样式 */ /* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */ background-color: #ccc;
border-radius: 0.315rem; /* 设置滑块的圆角 */ /* 设置滑块的背景色 */
border-radius: 0.315rem;
/* 设置滑块的圆角 */
} }
/* 设置滚动条鼠标悬停时的滑块样式 */ /* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */ background-color: #999;
/* 设置鼠标悬停时滑块的背景色 */
} }
</style> </style>

View File

@ -65,6 +65,28 @@ const printReceipt = (content = "") => {
}); });
}; };
// -
const letPrintReceipt = (content = "") => {
console.log("预打印");
let str = printTicket(content, true)
console.log(str);
if (isPrint) return;
isPrint = true;
uni.getEnv((res) => {
if (res.h5) {
ElMessage.error("请使用APP打印小票");
isPrint = false;
} else {
APPprint(str);
setTimeout(() => {
isPrint = false;
}, 4000);
}
});
};
// APP // APP
const APPprint = (content = "") => { const APPprint = (content = "") => {
let str = ""; let str = "";
@ -82,6 +104,7 @@ const APPprint = (content = "") => {
onMounted(() => { onMounted(() => {
mitt.on("printReceipt", printReceipt); mitt.on("printReceipt", printReceipt);
mitt.on("letPrintReceipt", letPrintReceipt);
// //
window.addEventListener( window.addEventListener(
"message", "message",
@ -91,7 +114,7 @@ onMounted(() => {
let str = event.data.data.address; let str = event.data.data.address;
printStore.setConnect(true); printStore.setConnect(true);
printStore.setPrintAddress(str); printStore.setPrintAddress(str);
ElMessage.success("已连接打印机T58("+str+")"); ElMessage.success("已连接打印机T58(" + str + ")");
} }
}, },
false false
@ -100,6 +123,7 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
mitt.off("printReceipt", printReceipt); mitt.off("printReceipt", printReceipt);
mitt.off("letPrintReceipt", letPrintReceipt);
}); });
</script> </script>
@ -107,31 +131,29 @@ onUnmounted(() => {
<div class="my-card"> <div class="my-card">
<div class="card-header"> <div class="card-header">
<div style="width: 4.5rem"> <div style="width: 4.5rem">
<el-image <el-image style="height: 2.5rem; width: 2.5rem; margin: 0 auto"
style="height: 2.5rem; width: 2.5rem; margin: 0 auto" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/12c93202404101530591311.png"></el-image>
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/12c93202404101530591311.png"
></el-image>
</div> </div>
<div class="card-title">泸优采收银系统</div> <div class="card-title">泸优采收银系统</div>
<div <div style="
style="
margin-left: 1rem; margin-left: 1rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
" ">
> <el-icon color="#fff" size="18" @click="onRefresh">
<el-icon color="#fff" size="18" @click="onRefresh"><Refresh /></el-icon> <Refresh />
</el-icon>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div style="margin-right: 1rem"> <div style="margin-right: 1rem">
<el-button @click="mitt.emit('printReceipt')" type="primary"> <el-button @click="mitt.emit('letPrintReceipt')" type="primary">
<span>打印自检</span> <span>打印自检</span>
</el-button> </el-button>
</div> </div>
<div style="margin-right: 1rem" v-if="!printStore.is_connect||!printStore.printAddress"> <div style="margin-right: 1rem" v-if="!printStore.is_connect || !printStore.printAddress">
<el-button @click="connect" type="warning"> <el-button @click="connect" type="warning">
<span>点击自动连接打印机</span> <span>点击自动连接打印机</span>
</el-button> </el-button>
@ -154,9 +176,9 @@ onUnmounted(() => {
<el-avatar :src="merInfo.avatar" icon="user-filled" /> <el-avatar :src="merInfo.avatar" icon="user-filled" />
<div class="info"> <div class="info">
<div> <div>
{{ merInfo.merchant.mer_name }} {{ merInfo.name }}
</div> </div>
<div>{{ merInfo.merchant.service_phone }}</div> <div>({{ merInfo.role_name }})</div>
</div> </div>
<el-icon class="el-icon--right"> <el-icon class="el-icon--right">
<arrow-down /> <arrow-down />
@ -179,23 +201,28 @@ onUnmounted(() => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.card-header { .card-header {
display: flex; display: flex;
align-items: center; align-items: center;
.card-title { .card-title {
font-size: 1.6rem; font-size: 1.6rem;
} }
} }
.card-body { .card-body {
display: flex; display: flex;
align-items: center; align-items: center;
} }
} }
.el-dropdown-link { .el-dropdown-link {
width: auto; width: auto;
display: flex; display: flex;
color: #fff; color: #fff;
align-items: center; align-items: center;
.info { .info {
margin: 0 0.5rem; margin: 0 0.5rem;
display: flex; display: flex;
@ -204,6 +231,7 @@ onUnmounted(() => {
height: 100%; height: 100%;
} }
} }
.el-dropdown { .el-dropdown {
border: none; border: none;
} }

View File

@ -47,6 +47,12 @@ const routes = [
meta: { title: '提现' }, meta: { title: '提现' },
component: () => import('@/views/wallet/index.vue'), component: () => import('@/views/wallet/index.vue'),
}, },
{
path: '/convert',
name: 'convert',
meta: { title: '订单核销' },
component: () => import('@/views/convert/index.vue'),
},
{ {
path: '/test', path: '/test',
name: 'test', name: 'test',

View File

@ -1,63 +1,141 @@
import * as Esc from "@/utils/EscPostUtils.js"; import * as Esc from "@/utils/EscPostUtils.js";
// const testObj = {
// mer_name: "莲花农贸市场", //商户名称
// service_phone: "0830-2669767", //客服电话
// number: "PF171568087790938356", //单号
// create_time: "2024-5-15 18:00:32", //下单时间
// total_price: "29.96", //总价
// pay_price: "29.96", //实付
// pay_type: "微信支付", //支付方式
// pay_number: "4200002159202405159003084211", //支付单号
// goods: [
// {
// name: "白菜 大白菜", //商品名称
// sell: "236.60", //单价
// nums: "13", //数量
// unit_name: "kg", //单位
// total: "2896.34" //小计
// },
// {
// name: "小黄鸭", //商品名称
// sell: "9.56", //单价
// nums: "2", //数量
// unit_name: "只", //单位
// total: "19.38" //小计
// },
// {
// name: "卷心菜", //商品名称
// sell: "15.37", //单价
// nums: "8", //数量
// unit_name: "斤", //单位
// total: "134.38" //小计
// }
// ]
// }
const testObj = { const testObj = {
mer_name: "莲花农贸市场", //商户名称 "id": 119,
service_phone: "0830-2669767", //客服电话 "store_id": 5,
number: "PF171568087790938356", //单号 "staff_id": 0,
create_time: "2024-5-15 18:00:32", //下单时间 "order_id": "PF1717833856721652",
total_price: "29.96", //总价 "pid": null,
pay_price: "29.96", //实付 "uid": 0,
pay_type: "微信支付", //支付方式 "real_name": "",
pay_number: "4200002159202405159003084211", //支付单号 "user_phone": "",
goods: [ "user_address": "",
"cart_id": "79",
"freight_price": "0.00",
"total_num": 1,
"total_price": "0.00",
"total_postage": "0.00",
"pay_price": "0.00",
"cost": "0.00",
"profit": "0.00",
"earnings": "0.00",
"vip_price": "0.00",
"pay_postage": "0.00",
"deduction_price": "0.00",
"coupon_id": 0,
"coupon_price": "0.00",
"paid": 1,
"pay_time": 1717833856,
"pay_type": "现金支付",
"status": 2,
"refund_status": 0,
"refund_type": 0,
"refund_express": "",
"refund_reason_wap_img": null,
"refund_reason_wap_explain": "",
"refund_reason_time": 0,
"refund_cancle_time": null,
"refund_reason_wap": "",
"refund_reason": "",
"refund_num": 0,
"refund_price": "0.00",
"delivery_name": "",
"delivery_code": "",
"delivery_type": "",
"delivery_id": "",
"fictitious_content": "",
"delivery_uid": 0,
"mark": "",
"remark": "",
"mer_id": 0,
"verify_code": "6-1717833856",
"shipping_type": 2,
"reservation": 0,
"reservation_time": null,
"is_writeoff": 1,
"is_remind": 0,
"create_time": "2024-06-08 16:04:16",
"update_time": "2024-06-08 16:56:23",
"delete_time": null,
"system_store_name": "新店",
"system_store_phone": "15699996666",
"staff_name": "新店阿萨",
"staff_phone": "15699996666",
"nickname": "",
"user_mobile": "",
"info": [
{ {
name: "白菜 大白菜", //商品名称 "store_id": 5,
sell: "236.60", //单价 "product_id": 30,
nums: "13", //数量 "cart_num": 1,
unit_name: "kg", //单位 "price": null,
total: "2896.34" //小计 "total_price": null,
}, "unit_name": "只",
{ "store_name": "1"
name: "小黄鸭", //商品名称
sell: "9.56", //单价
nums: "2", //数量
unit_name: "只", //单位
total: "19.38" //小计
},
{
name: "卷心菜", //商品名称
sell: "15.37", //单价
nums: "8", //数量
unit_name: "斤", //单位
total: "134.38" //小计
} }
] ]
} }
export const printTicket = (obj = {}, test = false) => { export const printTicket = (obj = {}, test = false) => {
let str = ""; let str = "";
if(!obj || !obj.number) obj = testObj; if(!obj || !obj.order_id) obj = testObj;
str += Esc.Size2(0) + Esc.Center() + Esc.boldFontOn() + obj.mer_name + "\n"; str += Esc.Size2(0) + Esc.Center() + Esc.boldFontOn() + obj.system_store_name + "\n";
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n"; str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
str += Esc.Left() + "单号: " + obj.number + "\n"; str += Esc.Left() + "单号: " + obj.order_id + "\n";
str += Esc.Left() + "下单时间: " + obj.create_time + "\n"; str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
// 商品信息 // 商品信息
str += Esc.fillLine("=") + "\n"; str += Esc.fillLine("=") + "\n";
str += Esc.inline3("单价", "数量", "小计", " ", 1) + "\n"; str += Esc.inline3("单价", "数量", "小计", " ", 1) + "\n";
obj.goods.forEach(item => { obj.info.forEach(item => {
str += Esc.Left() + item.name + "\n"; str += Esc.Left() + item.store_name + "\n";
str += Esc.inline3(`${item.sell}`, `${item.nums}${item.unit_name}`, `${item.total}`, " ", 1) + "\n"; let total = +item.price || 0;
total *= +item.cart_num;
str += Esc.inline3(`${item.price || '0.00'}`, `${item.cart_num}${item.unit_name}`, `${total}`, " ", 1) + "\n";
}) })
str += Esc.fillLine("=") + "\n"; str += Esc.fillLine("=") + "\n";
str += Esc.Left() + "应付款: " + obj.total_price + "元" + "\n"; str += Esc.Left() + "合计: " + obj.total_price + "元" + "\n";
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n"; str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
str += Esc.Left() + "支付方式: " + obj.pay_type + "\n"; str += Esc.Left() + "支付方式: " + obj.pay_type + "\n";
str += Esc.Left() + "支付单号: " + obj.pay_number + "\n"; // str += Esc.Left() + "支付单号: " + obj.order_id + "\n";
str += Esc.Left() + "联系电话: " + obj.service_phone + "\n"; str += Esc.Left() + "联系电话: " + obj.system_store_phone + "\n";
str += Esc.fillLine("=") + "\n"; str += Esc.fillLine("=") + "\n";
// 票尾 // 票尾

View File

@ -1,11 +1,13 @@
<script setup> <script setup>
import { nextTick, ref } from "vue"; import { onMounted, onUnmounted, ref } from "vue";
import { import {
orderListApi, orderListApi,
orderStatusApi, orderStatusApi,
orderLadingApi, orderLadingApi,
cartListApi, cartListApi,
verifierApi, cashierinfoListApi,
cashierinfoDetailsApi,
writeoffOrderApi
} from "@/api/store.js"; } from "@/api/store.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@ -16,12 +18,8 @@ import pay from "@/components/pay.vue";
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
const formData = ref({}); const formData = ref({
mitt.on("set-order-detail", (res) => { id: "",
formData.value = res;
nextTick(()=>{
tableRef.value?.toggleAllSelection();
})
}); });
const list = ref([]); const list = ref([]);
@ -43,6 +41,7 @@ const orderLading = () => {
dialogVisible.value = false; dialogVisible.value = false;
orderLadingApi({ orderLadingApi({
order_sn: orderLadingSn.value, order_sn: orderLadingSn.value,
staff_id: userStore.userInfo.service.service_id,
}).then((res) => { }).then((res) => {
ElMessage({ ElMessage({
message: res.message, message: res.message,
@ -72,6 +71,8 @@ const getOrderStatus = (id) => {
message: res.message, message: res.message,
type: "success", type: "success",
}); });
mitt.emit("update-sale-order-detail", {});
formData.value.paid = 1;
} else { } else {
ElMessage({ ElMessage({
message: res.message, message: res.message,
@ -79,118 +80,94 @@ const getOrderStatus = (id) => {
}); });
} }
}) })
.catch((err) => {}); .catch((err) => { });
}; };
const emit = defineEmits(['reInit']) const where = ref({
const tableRef = ref(null); page_no: 1,
// page_size: 15,
const convert = ()=>{ loadend: false,
let tableList = tableRef.value.getSelectionRows(); loading: false,
if(tableList.length == 0){ });
return ElMessage.error('请选择核销商品'); const goods_list = ref([]);
} const getOrderList = () => {
let query = { console.log("触底");
data: [], if (formData.value.id && !where.value.loadend) {
verify_code: formData.value.verify_code console.log("加载");
} where.value.loading = true;
tableList.forEach(item => { cashierinfoListApi({
query.data.push({ pid: formData.value.id,
id: item.order_product_id, page_no: where.value.page_no,
num: item.product_num page_size: where.value.page_size,
}) }).then((res) => {
goods_list.value = [...goods_list.value, ...res.data.lists];
if (res.data.lists.length < where.value.page_size)
where.value.loadend = true;
where.value.loading = false;
where.value.page_no++;
}); });
verifierApi(userStore.userInfo.service.mer_id, formData.value.order_id, query).then(res=>{ }
ElMessage.success(res.message); };
emit('reInit');
}).catch(err=>{ const getDetail = () => {
ElMessage.error(err.message) loading.value = true;
cashierinfoDetailsApi({
id: formData.value.id,
}).then(res => {
formData.value = res.data;
setTimeout(() => {
loading.value = false;
}, 200)
}) })
} }
const convert = ()=>{
writeoffOrderApi({
verify_code: formData.value.verify_code
}).then(res=>{
formData.value.verify_code = 1;
})
}
onMounted(() => {
mitt.on("set-sale-order-detail", (res) => {
console.log("===", res);
formData.value = res;
where.value.page_no = 1;
where.value.loadend = false;
where.value.loading = false;
goods_list.value = [];
// getDetail();
// getOrderList();
});
});
onUnmounted(() => {
mitt.off("set-sale-order-detail");
});
</script> </script>
<template> <template>
<div class="my-order"> <div class="my-order">
<div class="header-nav"> <div class="detail" v-if="formData.id" v-loading="loading">
<div <div class="table" v-infinite-scroll="getOrderList" :infinite-scroll-distance="300"
v-for="(item, index) in activeStoreList" :infinite-scroll-delay="300" style="overflow: auto" :infinite-scroll-immediate="false">
:key="index"
class="nav-item"
:class="{
'nav-item-active': activeStore == index,
'nav-item-radius1': activeStore == index + 1,
'nav-item-radius2': activeStore == index - 1,
}"
@click="activeStore = index"
>
{{ item }}
</div>
<div
class="nav-item"
:class="{
'nav-item-radius2': activeStore == activeStoreList.length - 1,
}"
style="flex: 1"
></div>
</div>
<div class="detail" v-loading="loading">
<div class="table" v-if="formData.orderProduct && activeStore == 0">
<div style="font-size: 0.9rem">
共计
<span style="color: #ff4a00">{{ formData.total_num }}</span> 件商品
</div>
<el-table
style="height: calc(100vh - 100px - 14rem)"
:data="formData.orderProduct"
ref="tableRef"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="cart_info.product.store_name" label="商品信息">
<template #default="{ row }">
<div style="display: flex; align-items: center">
<el-image
style="height: 3rem; width: 3rem"
:src="
row.cart_info.productAttr.image ||
row.cart_info.product.image
"
></el-image>
<span style="margin-left: 0.5rem">{{
row.cart_info.product.store_name
}}</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="cart_info.productAttr.price"
label="单价"
width="150"
/>
<el-table-column prop="product_num" label="数量" width="180">
<template #default="{ row }">
<el-input-number v-model="row.product_num" step-strictly :max="row.refund_num" :min="1" :step="1" size="small"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="total_price" label="总价" width="150" />
</el-table>
</div>
<div class="table" v-if="formData.orderProduct && activeStore == 1">
<div class="table-title">订单信息</div> <div class="table-title">订单信息</div>
<div class="table-info"> <div class="table-info">
<div class="info-item"> <div class="info-item">
<div class="info-item-title">创建时间:</div> <div class="info-item-title">订单编号:</div>
<div class="info-item-info">{{ formData.create_time }}</div> <div class="info-item-info">{{ formData.order_id }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品:</div> <div class="info-item-title">商品款数:</div>
<div class="info-item-info">{{ formData.total_num }}</div> <div class="info-item-info">{{ formData.total_num || 0 }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品总价:</div> <div class="info-item-title">商品总价:</div>
<div class="info-item-info">¥{{ formData.total_price }}</div> <div class="info-item-info">¥{{ formData.total_price }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付时间:</div> <div class="info-item-title">创建时间:</div>
<div class="info-item-info">{{ formData.pay_time }}</div> <div class="info-item-info">{{ formData.pay_time }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
@ -201,81 +178,48 @@ const convert = ()=>{
<div class="info-item-title">实际支付:</div> <div class="info-item-title">实际支付:</div>
<div class="info-item-info">¥{{ formData.pay_price }}</div> <div class="info-item-info">¥{{ formData.pay_price }}</div>
</div> </div>
<div class="info-item">
<div class="info-item-title">支付时间:</div>
<div class="info-item-info">{{ formData.pay_time }}</div>
</div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付方式:</div> <div class="info-item-title">支付方式:</div>
<div class="info-item-info"> <div class="info-item-info">
<span v-if="formData.pay_type == 11">微信收款</span> <span v-if="formData.pay_type == 9">微信收款</span>
<span v-if="formData.pay_type == 12">现金支付</span> <span v-if="formData.pay_type == 17">现金支付</span>
<span v-if="formData.pay_type == 13">支付宝收款</span> <span v-if="formData.pay_type == 13">支付宝收款</span>
<span v-if="formData.pay_type == 0">余额支付</span> <span v-if="formData.pay_type == 3">余额支付</span>
<span v-if="formData.pay_type == 1">微信支付</span> <span v-if="formData.pay_type == 1">微信支付</span>
<span v-if="formData.pay_type == 9">商户余额支付</span>
<span v-if="formData.pay_type == 10">对公转账</span>
</div> </div>
</div> </div>
</div> </div>
<div class="table-title" v-if="formData.service_info">收银员信息</div> <div style="font-size: 0.9rem">
<div 共计
class="table-info" <span style="color: #ff4a00">{{ formData.product?.length || " " }}</span> 款商品
v-if="formData.service_info"
style="flex-direction: column"
>
<div class="info-item">
<div class="info-item-title">头像:</div>
<div class="info-item-info">
<el-image
style="height: 4rem; width: 4rem; border-radius: 50%"
:src="formData.service_info.avatar"
></el-image>
</div> </div>
</div> <el-table :data="formData.product">
<div class="info-item"> <el-table-column label="商品信息">
<div class="info-item-title">昵称:</div> <template #default="{ row }">
<div class="info-item-info"> <div style="display: flex; align-items: center">
{{ formData.service_info.nickname }} <el-image style="height: 3rem; width: 3rem" :src="row.cart_info?.image"></el-image>
</div> <span style="margin-left: 0.5rem">{{ row.cart_info?.name }}</span>
</div>
<div class="info-item">
<div class="info-item-title">账号:</div>
<div class="info-item-info">
{{ formData.service_info.account }}
</div>
</div>
</div>
</div>
<div class="footer">
<div class="info">
<!-- <div class="ser">收银员: {{ formData.service_info.nickname }}</div> -->
<div class="price">
实付: <span>¥{{ formData.pay_price }}</span>
</div>
</div>
<div class="handle" v-if="formData.verify_status==0">
<el-button class="btn" type="warning" @click="convert"
>核销</el-button
>
</div>
<div class="handle" v-else>已支付</div>
</div>
</div>
<pay ref="payRef" />
<el-dialog v-model="dialogVisible" title="提示" width="500">
<span
>提单前请清空购物车, 避免提单的商品与购物车商品混合,
请确保购物车内无数据后再进行提单</span
>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-if="cartCount > 0" @click="goHome">
前去清空购物车
</el-button>
<el-button v-else type="primary" @click="orderLading">
确认提单
</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-table-column>
<el-table-column prop="cart_info.price" label="单价" width="150" />
<el-table-column prop="cart_info.cart_num" label="数量" width="150" />
<el-table-column prop="cart_info.total" label="总价" width="150">
</el-table-column>
</el-table>
</div>
<div class="footer">
<el-button v-if="formData.is_writeoff==0" type="primary" size="large" :disabled="formData.is_writeoff" @click="convert">立即核销</el-button>
<div v-else>该订单已核销</div>
</div>
</div>
<div v-else>
<el-empty description="没找到核销订单信息"></el-empty>
</div>
</div> </div>
</template> </template>
@ -288,55 +232,28 @@ const convert = ()=>{
position: relative; position: relative;
overflow: hidden; overflow: hidden;
.header-nav {
display: flex;
background: linear-gradient(
to bottom,
#f5f5f5 50%,
#fff 50%
); /* 创建渐变背景 */
.nav-item {
height: 4rem;
width: 8rem;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.2rem;
background-color: #f5f5f5;
border-radius: 1rem 1rem 0 0;
}
.nav-item-active {
background-color: #fff;
position: relative;
transition: 300ms;
}
.nav-item-radius1 {
border-radius: 0 0 1rem 0;
}
.nav-item-radius2 {
border-radius: 0 0 0 1rem;
}
}
.detail { .detail {
height: calc(100vh - 100px - 4rem); height: 100%;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
.table { .table {
padding: 1rem; padding: 1rem;
padding-bottom: 6rem; padding-bottom: 6rem;
overflow-y: auto;
height: 100%;
.table-title { .table-title {
font-weight: bold; font-weight: bold;
padding-top: 1rem;
} }
.table-info { .table-info {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
color: #777; color: #777;
font-size: 0.9rem; font-size: 0.9rem;
padding-bottom: 2rem; padding-bottom: 1rem;
margin-bottom: 1rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
&:last-child { &:last-child {
@ -347,6 +264,7 @@ const convert = ()=>{
width: 33%; width: 33%;
display: flex; display: flex;
padding-top: 1rem; padding-top: 1rem;
.info-item-title { .info-item-title {
flex-shrink: 0; flex-shrink: 0;
padding-right: 1rem; padding-right: 1rem;
@ -356,40 +274,18 @@ const convert = ()=>{
} }
.footer { .footer {
height: 6rem;
box-sizing: border-box;
padding: 0 1.5rem;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
box-shadow: 0 -1px 0.625rem #eee; height: 6rem;
display: flex; box-sizing: border-box;
justify-content: space-between;
align-items: center;
background-color: #fff; background-color: #fff;
.info {
display: flex; display: flex;
align-items: flex-end; justify-content: flex-end;
.ser { align-items: center;
font-weight: bold; padding: 0 2rem;
margin-right: 1rem; border-top: 1px solid #eee;
}
.price {
margin-right: 1rem;
span {
color: #ff4a00;
font-size: 1.2rem;
font-weight: bold;
}
}
}
.handle {
.btn {
border-radius: 4rem;
padding: 1.2rem;
}
}
} }
} }
} }

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { import {
verifierOrderListApi, saleOrderListApi,
cashierinfoDetailsApi,
orderStatusApi, orderStatusApi,
orderLadingApi, orderLadingApi,
cartListApi, cartListApi,
@ -15,22 +16,10 @@ const userStore = useUserStore();
const list = ref([]); const list = ref([]);
const tabPosition = ref(1); // 1-, 2-
const changeTabPosition = (e) => {
where.value.page_no = 1;
loadEnd.value = false;
loading.value = false;
orderList.value = [];
getOrderList(true);
};
const payRef = ref(null); const payRef = ref(null);
const where = ref({ const where = ref({
page_no: 1, verify_code: ''
page_size: 20,
search_info: ''
}); });
@ -40,29 +29,18 @@ const activeStore = ref(0);
const loadEnd = ref(false); const loadEnd = ref(false);
const orderList = ref([]); const orderList = ref([]);
const getOrderList = (reload=false) => { const getOrderList = (reload = false) => {
if(!where.value.search_info) return ElMessage.error("请输入订单编号"); cashierinfoDetailsApi(where.value)
if(reload) where.value.page_no = 1; .then((res) => {
else if(loadEnd.value || loading.value) return;
loading.value = true;
if (tabPosition.value == 1) where.value.paid = null;
if (tabPosition.value == 2) where.value.paid = 0;
orderList.value = [];
mitt.emit("set-order-detail", {});
verifierOrderListApi(userStore.userInfo.service.mer_id, where.value.search_info).then((res) => {
orderList.value = [res.data]; orderList.value = [res.data];
mitt.emit("set-order-detail", orderList.value[0]); activeStore.value = 0;
// if(reload) orderList.value = res.data.list; mitt.emit("set-sale-order-detail", orderList.value[0]);
// else orderList.value = [...orderList.value, ...res.data.list]; total.value = res.data.count;
// if(res.data.list.length < where.value.page_size) loadEnd.value = true; if(orderList.value[0].is_writeoff) {
// else where.value.page_no++; ElMessage.warning('订单已核销过')
// activeStore.value = 0; }
// mitt.emit("set-order-detail", orderList.value[0]); })
// total.value = res.data.count; .catch((err) => {
loading.value = false;
}).catch(err=>{
loadEnd.value = true;
loading.value = false;
}); });
}; };
@ -71,14 +49,14 @@ const setForm = (item, index) => {
mitt.emit("set-order-detail", item); mitt.emit("set-order-detail", item);
} }
const setCode = (code)=>{ const setCode = (code) => {
where.value.search_info = code; where.value.verify_code = code;
getOrderList(true); getOrderList(true);
} }
const emit = defineEmits(["backOne"]); const emit = defineEmits(["backOne"]);
const backOne = ()=>{ const backOne = () => {
emit("backOne"); emit("backOne");
} }
@ -96,66 +74,54 @@ defineExpose({
</div> </div>
</div> </div>
<div class="header-input"> <div class="header-input">
<el-input v-model="where.search_info" placeholder="请输入订单编号" @keydown.enter="getOrderList(true)" clearable> <el-input v-model="where.verify_code" placeholder="请输入核销码" @keydown.enter="getOrderList(true)" clearable>
<template #append> <template #append>
<el-button <el-button type="primary" style="
type="primary"
style="
background-color: #1890ff; background-color: #1890ff;
color: #fff; color: #fff;
border-radius: 0 0.315rem 0.315rem 0; border-radius: 0 0.315rem 0.315rem 0;
" " @click="getOrderList(true)">搜索</el-button>
@click="getOrderList(true)"
>搜索</el-button
>
</template> </template>
</el-input> </el-input>
</div> </div>
<div class="order-list" v-loading="loading" v-infinite-scroll="getOrderList" <div class="order-lists" v-loading="loading" :infinite-scroll-distance="300" :infinite-scroll-delay="500"
:infinite-scroll-distance="300"
:infinite-scroll-delay="500"
infinite-scroll-immediate="false"
style="overflow: auto"> style="overflow: auto">
<div class="item" :class="{'item-active': activeStore == index}" v-for="(item, index) in orderList" :key="index" @click="setForm(item, index)"> <div class="item" :class="{ 'item-active': activeStore == index }" v-for="(item, index) in orderList"
:key="index" @click="setForm(item, index)">
<div class="top"> <div class="top">
<div class="sn" :class="item.pay_type===11 || item.pay_type===12 || item.pay_type===13 ? 'cahier' : 'cahier2'">单号: {{ item.order_sn }}</div> <div class="sn" :class="'cahier'">单号: {{ item.order_id }}</div>
<div class="create-time">{{ item.create_time }}</div> <div class="create-time">{{ item.pay_time }}</div>
</div> </div>
<div class="shop"> <div class="shop">
<div class="left" v-if="item.orderProduct"> <div class="left" v-if="item.product">
<el-image <el-image v-for="(shop, imgkey) in item.product.slice(0, 5)" :key="imgkey" :src="shop.cart_info.image"
v-for="(shop, imgkey) in item.orderProduct.slice(0, 5)" class="shop-img"></el-image>
:key="imgkey" <div v-if="item.product.length == 1" class="shop-name">
:src=" {{ item.product[0].store_name }}
shop.cart_info.productAttr.image || shop.cart_info.product.image
"
class="shop-img"
></el-image>
<div v-if="item.orderProduct.length == 1" class="shop-name">
{{ item.orderProduct[0].cart_info.product.store_name }}
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div class="money">¥{{ item.pay_price }}</div> <div class="money">¥{{ item.pay_price }}</div>
<div class="count">{{ item.total_num }}商品</div> <div class="count">{{ item.total_num }}款商品</div>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="pay"> <div class="pay">
<div v-if="item.paid"> <div v-if="item.paid">
已支付 {{ item.paid_name }}
<span v-if="item.pay_type == 9">(微信收款)</span>
<span v-if="item.pay_type == 17">(现金支付)</span>
<span v-if="item.pay_type == 13">(支付宝收款)</span> <span v-if="item.pay_type == 13">(支付宝收款)</span>
<span v-if="item.pay_type == 12">(现金支付)</span> <span v-if="item.pay_type == 3">(余额支付)</span>
<span v-if="item.pay_type == 11">(微信收款)</span>
<span v-if="item.pay_type == 0">(余额支付)</span>
<span v-if="item.pay_type == 1">(微信支付)</span> <span v-if="item.pay_type == 1">(微信支付)</span>
<span v-if="item.pay_type == 9">(商户余额支付)</span>
<span v-if="item.pay_type == 10">(对公转账)</span>
</div> </div>
<div v-else style="color: #ff4a00;">未支付</div> <div v-else style="color: #ff4a00">{{ item.paid_name }}</div>
</div> </div>
<div class="cashier" v-if="item.service_info">收银员: {{ item.service_info.nickname }}</div> <!-- <div class="cashier" v-if="item.service_info">
<div class="cashier" v-else>平台订单</div> 收银员: {{ item.service_info.nickname }}
</div> -->
<div class="cashier" v-if="item.is_writeoff==0">核销码{{ item.verify_code }}</div>
<div class="cashier" v-else style="color: #ff4a00">已核销{{ item.verify_code }}</div>
</div> </div>
</div> </div>
<div v-if="loadEnd" class="load-end">没有更多了</div> <div v-if="loadEnd" class="load-end">没有更多了</div>
@ -182,6 +148,7 @@ defineExpose({
span { span {
color: #ff4a00; color: #ff4a00;
} }
.nav-item-clear { .nav-item-clear {
display: flex; display: flex;
align-items: center; align-items: center;
@ -189,27 +156,33 @@ defineExpose({
cursor: pointer; cursor: pointer;
} }
} }
.header-input { .header-input {
padding: 1rem; padding: 1rem;
padding-top: 0; padding-top: 0;
height: 2.5rem; height: 2.5rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
.order-list {
height: calc(100vh - 100px - 8.2rem); .order-lists {
height: calc(100vh - 100px - 10.2rem);
overflow-y: auto; overflow-y: auto;
.item { .item {
padding: 1rem; padding: 1rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
.top { .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
.sn { .sn {
font-weight: bold; font-weight: bold;
font-size: 0.9rem; font-size: 0.9rem;
} }
.cahier{
.cahier {
&::before { &::before {
content: "收银"; content: "收银";
font-weight: 400; font-weight: 400;
@ -218,10 +191,11 @@ defineExpose({
margin-right: 0.2rem; margin-right: 0.2rem;
border: 1px solid #2ec479; border: 1px solid #2ec479;
color: #2ec479; color: #2ec479;
border-radius: 0.18rem; border-radius: 0.187rem;
} }
} }
.cahier2{
.cahier2 {
&::before { &::before {
content: "平台"; content: "平台";
font-weight: 400; font-weight: 400;
@ -230,41 +204,49 @@ defineExpose({
margin-right: 0.2rem; margin-right: 0.2rem;
border: 1px solid #ff4a00; border: 1px solid #ff4a00;
color: #ff4a00; color: #ff4a00;
border-radius: 0.18rem; border-radius: 0.187rem;
} }
} }
.create-time { .create-time {
font-size: 0.8rem; font-size: 0.8rem;
} }
} }
.shop { .shop {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.right { .right {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.money { .money {
font-size: 1rem; font-size: 1rem;
color: #ff4a00; color: #ff4a00;
font-weight: bold; font-weight: bold;
} }
.count { .count {
font-size: 0.7rem; font-size: 0.7rem;
color: #999; color: #999;
} }
} }
.left { .left {
height: 4.5rem; height: 4.5rem;
display: flex; display: flex;
align-items: center; align-items: center;
.shop-img { .shop-img {
width: 3.5rem; width: 3.5rem;
height: 3.5rem; height: 3.5rem;
border-radius: 0.3rem; border-radius: 0.3rem;
margin-right: 0.4rem; margin-right: 0.4rem;
} }
.shop-name { .shop-name {
font-size: 0.9rem; font-size: 0.9rem;
color: #333; color: #333;
@ -276,18 +258,30 @@ defineExpose({
} }
} }
} }
.bottom{
.bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 0.9rem; font-size: 0.9rem;
color: #777; color: #777;
.manage-btn {
color: #fff;
background-color: #e6a23c;
border-radius: 0.2rem;
padding: 0 0.2rem;
margin-left: 0.5rem;
} }
} }
.item-active{ }
.item-active {
background-color: #efefef; background-color: #efefef;
} }
} }
.load-end{
.load-end {
text-align: center; text-align: center;
padding: 1rem; padding: 1rem;
color: #333; color: #333;

View File

@ -91,6 +91,7 @@ onMounted(() => {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
} }
} }
} }

View File

@ -36,7 +36,7 @@ const getStoreList = (data={}, reload=false) => {
where.value.page_no = 1; where.value.page_no = 1;
loadEnd.value = false; loadEnd.value = false;
} }
storeListApi(userStore.userInfo.service.mer_id, where.value).then((res) => { storeListApi(userStore.userInfo.service.store_id, where.value).then((res) => {
if (res.data?.list?.length < where.value.page_size) loadEnd.value = true; if (res.data?.list?.length < where.value.page_size) loadEnd.value = true;
let list = res.data.list.map((item) => { let list = res.data.list.map((item) => {
item.attr = Object.keys(item.sku); item.attr = Object.keys(item.sku);
@ -69,15 +69,8 @@ function isAllDigits(str) {
const cartAddInfo = (item, change = "") => { const cartAddInfo = (item, change = "") => {
// console.log(item, change); // console.log(item, change);
let q = { let q = {
is_new: 0,
product_id: item.product_id, product_id: item.product_id,
cart_num: 1, cart_num: 1,
product_attr_unique:
item.sku[change] !== undefined ? item.sku[change].unique : "",
staff_id: userStore.userInfo.service.service_id,
product_type: 0,
// spread_id: this.currSpid,
// sale_type: 1
}; };
cartCreateApi(q).then((res) => { cartCreateApi(q).then((res) => {
orderRef.value.getList(); orderRef.value.getList();

View File

@ -14,8 +14,7 @@ const pwdRef = ref(null);
const formLogin = ref({ const formLogin = ref({
account: "", account: "",
password: "", password: "",
terminal: 3, terminal: 1,
scene: 1,
}); });
const onLogin = () => { const onLogin = () => {
@ -32,7 +31,6 @@ const onLogin = () => {
login(formLogin.value) login(formLogin.value)
.then((res) => { .then((res) => {
if (res.data?.token) { if (res.data?.token) {
if(!res.data.merchant||!res.data.merchant.service_phone) return ElMessage.error("请先完善商户信息");
userStore.setToken(res.data.token); userStore.setToken(res.data.token);
userStore.setUserInfo(res.data); userStore.setUserInfo(res.data);
router.push("/"); router.push("/");

View File

@ -6,6 +6,7 @@ import {
orderLadingApi, orderLadingApi,
cartListApi, cartListApi,
cashierinfoListApi, cashierinfoListApi,
cashierinfoDetailsApi
} from "@/api/store.js"; } from "@/api/store.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@ -69,7 +70,7 @@ const getOrderStatus = (id) => {
message: res.message, message: res.message,
type: "success", type: "success",
}); });
mitt.emit("update-c-order-detail", {}); mitt.emit("update-sale-order-detail", {});
formData.value.paid = 1; formData.value.paid = 1;
} else { } else {
ElMessage({ ElMessage({
@ -107,57 +108,64 @@ const getOrderList = () => {
} }
}; };
const emit = defineEmits(["addAddress"]); const getDetail = () =>{
const addAddress = (item) => { loading.value = true;
emit("addAddress", item); cashierinfoDetailsApi({
}; id: formData.value.id,
}).then(res=>{
formData.value = res.data;
setTimeout(()=>{
loading.value = false;
}, 200)
})
}
onMounted(() => { onMounted(() => {
mitt.on("set-c-order-detail", (res) => { mitt.on("set-sale-order-detail", (res) => {
console.log("===",res);
formData.value = res; formData.value = res;
where.value.page_no = 1; where.value.page_no = 1;
where.value.loadend = false; where.value.loadend = false;
where.value.loading = false; where.value.loading = false;
goods_list.value = []; goods_list.value = [];
getOrderList(); getDetail();
// getOrderList();
}); });
}); });
onUnmounted(() => { onUnmounted(() => {
mitt.off("set-c-order-detail"); mitt.off("set-sale-order-detail");
}); });
</script> </script>
<template> <template>
<div class="my-order"> <div class="my-order">
<div class="detail" v-loading="loading"> <div class="detail" v-if="formData.id" v-loading="loading">
<div <div
class="table" class="table"
v-loading="loading"
v-infinite-scroll="getOrderList" v-infinite-scroll="getOrderList"
:infinite-scroll-distance="300" :infinite-scroll-distance="300"
:infinite-scroll-delay="300" :infinite-scroll-delay="300"
style="overflow: auto" style="overflow: auto"
v-if="formData?.id"
:infinite-scroll-immediate="false" :infinite-scroll-immediate="false"
> >
<div class="table-title">订单信息</div> <div class="table-title">订单信息</div>
<div class="table-info"> <div class="table-info">
<div class="info-item"> <div class="info-item">
<div class="info-item-title">订单编号:</div> <div class="info-item-title">订单编号:</div>
<div class="info-item-info">{{ formData.number }}</div> <div class="info-item-info">{{ formData.order_id }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品款数:</div> <div class="info-item-title">商品款数:</div>
<div class="info-item-info">{{ formData.goods_count }}</div> <div class="info-item-info">{{ formData.total_num || 0 }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品总价:</div> <div class="info-item-title">商品总价:</div>
<div class="info-item-info">¥{{ formData.total }}</div> <div class="info-item-info">¥{{ formData.total_price }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">创建时间:</div> <div class="info-item-title">创建时间:</div>
<div class="info-item-info">{{ formData.create_time }}</div> <div class="info-item-info">{{ formData.pay_time }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">优惠抵扣:</div> <div class="info-item-title">优惠抵扣:</div>
@ -165,74 +173,49 @@ onUnmounted(() => {
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">实际支付:</div> <div class="info-item-title">实际支付:</div>
<div class="info-item-info">¥{{ formData.actual }}</div> <div class="info-item-info">¥{{ formData.pay_price }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付时间:</div> <div class="info-item-title">支付时间:</div>
<div class="info-item-info">{{ formData.update_time }}</div> <div class="info-item-info">{{ formData.pay_time }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付方式:</div> <div class="info-item-title">支付方式:</div>
<div class="info-item-info"> <div class="info-item-info">
<span v-if="formData.pay_type == 9">微信收款</span> <span v-if="formData.pay_type == 9">微信收款</span>
<span v-if="formData.pay_type == 17">现金支付</span>
<span v-if="formData.pay_type == 13">支付宝收款</span>
<span v-if="formData.pay_type == 3">余额支付</span> <span v-if="formData.pay_type == 3">余额支付</span>
<span v-if="formData.pay_type == 1">微信支付</span> <span v-if="formData.pay_type == 1">微信支付</span>
</div> </div>
</div> </div>
</div> </div>
<div class="table-title">收货人信息</div>
<div
class="table-info"
v-if="formData.user_phone"
style="flex-direction: column"
>
<div class="info-item">
<div class="info-item-title">收货人:</div>
<div class="info-item-info">
{{ formData.real_name }}
</div>
</div>
<div class="info-item">
<div class="info-item-title">联系方式:</div>
<div class="info-item-info">
{{ formData.user_phone }}
</div>
</div>
<div class="info-item">
<div class="info-item-title">收货地址:</div>
<div class="info-item-info">
{{ formData.user_address }}
</div>
</div>
</div>
<div v-else class="addAddress">
<el-button type="primary" @click="addAddress(formData)" size="large"
>点击添加收货地址</el-button
>
</div>
<div style="font-size: 0.9rem"> <div style="font-size: 0.9rem">
共计 共计
<span style="color: #ff4a00">{{ formData.goods_count }}</span> 款商品 <span style="color: #ff4a00">{{ formData.product?.length || " " }}</span> 款商品
</div> </div>
<el-table :data="goods_list"> <el-table :data="formData.product">
<el-table-column label="商品信息"> <el-table-column label="商品信息">
<template #default="{ row }"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-image <el-image
style="height: 3rem; width: 3rem" style="height: 3rem; width: 3rem"
:src="row.imgs" :src="row.cart_info?.image"
></el-image> ></el-image>
<span style="margin-left: 0.5rem">{{ row.goods_name }}</span> <span style="margin-left: 0.5rem">{{ row.cart_info?.name }}</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price" label="单价" width="150" /> <el-table-column prop="cart_info.price" label="单价" width="150" />
<el-table-column prop="nums" label="数量" width="150" /> <el-table-column prop="cart_info.cart_num" label="数量" width="150" />
<el-table-column prop="total" label="总价" width="150"> <el-table-column prop="cart_info.total" label="总价" width="150">
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
<div v-else>
<el-empty></el-empty>
</div>
</div> </div>
</template> </template>
@ -259,10 +242,6 @@ onUnmounted(() => {
.table-title { .table-title {
font-weight: bold; font-weight: bold;
} }
.addAddress {
margin-top: 1rem;
margin-bottom: 1.5rem;
}
.table-info { .table-info {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;

View File

@ -6,11 +6,10 @@ import {
orderLadingApi, orderLadingApi,
cartListApi, cartListApi,
saleOrderListApi, saleOrderListApi,
createOrderApi
} from "@/api/store.js"; } from "@/api/store.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useRoute } from "vue-router"; import { useRouter } from "vue-router";
import mitt from "@/utils/mitt.js"; import mitt from "@/utils/mitt.js";
import moment from "moment"; import moment from "moment";
@ -22,12 +21,10 @@ const props = defineProps({
}, },
source: { source: {
type: Number, type: Number,
default: 0, default: 1,
}, },
}); });
const route = useRoute();
const lists = ref([]); const lists = ref([]);
const tabPosition = ref(1); // 1-, 2- const tabPosition = ref(1); // 1-, 2-
@ -41,20 +38,25 @@ const changeTabPosition = (e) => {
const payRef = ref(null); const payRef = ref(null);
const changeDate = (e) => { const date = ref("");
const changeDate = () => {
where.value.start_time = moment(date.value[0]).format('YYYY-MM-DD 00:00:00');
where.value.end_time = moment(date.value[1]).format('YYYY-MM-DD 23:59:59');
getOrderList(true); getOrderList(true);
}; };
const disabledDate = (time)=>{
const disabledDate = (time) => {
return time.getTime() > Date.now(); return time.getTime() > Date.now();
} }
const where = ref({ const where = ref({
page_no: 1, page_no: 1,
page_size: 20, page_size: 20,
number: "", order_id: "",
date: moment(new Date()).format("YYYY-MM-DD"), start_time: "",
is_mer: 1 end_time: "",
// source: props.source, is_sashier: 2, // 1-, 2-
}); });
const loading = ref(false); const loading = ref(false);
@ -69,15 +71,14 @@ const getOrderList = (reload = false) => {
loading.value = true; loading.value = true;
if (tabPosition.value == 1) where.value.paid = null; if (tabPosition.value == 1) where.value.paid = null;
if (tabPosition.value == 2) where.value.paid = 0; if (tabPosition.value == 2) where.value.paid = 0;
dialogVisible.value = false; saleOrderListApi(where.value)
orderListApi(where.value)
.then((res) => { .then((res) => {
if (reload) orderList.value = res.data.lists; if (reload) orderList.value = res.data.lists;
else orderList.value = [...orderList.value, ...res.data.lists]; else orderList.value = [...orderList.value, ...res.data.lists];
if (res.data.lists.length < where.value.page_size) loadEnd.value = true; if (res.data.lists.length < where.value.page_size) loadEnd.value = true;
else where.value.page_no++; else where.value.page_no++;
activeStore.value = 0; activeStore.value = 0;
mitt.emit("set-c-order-detail", orderList.value[0]); mitt.emit("set-sale-order-detail", orderList.value[0]);
total.value = res.data.count; total.value = res.data.count;
loading.value = false; loading.value = false;
}) })
@ -87,44 +88,19 @@ const getOrderList = (reload = false) => {
}); });
}; };
const submitOrder = ()=>{
createOrderApi().then(res=>{
ElMessage.success("提交成功");
getOrderList(true);
mitt.emit("set-order-count-zero", res.data);
})
}
const setForm = (item, index) => { const setForm = (item, index) => {
activeStore.value = index; activeStore.value = index;
mitt.emit("set-c-order-detail", item); mitt.emit("set-sale-order-detail", item);
}; };
defineExpose({
getOrderList
})
const emit = defineEmits(['addAddress'])
const addAddress = (item)=>{
emit('addAddress',item)
}
const dialogVisible = ref(false);
onMounted(() => { onMounted(() => {
mitt.on("update-c-order-detail", (item) => { mitt.on("update-sale-order-detail", (item) => {
console.log("===");
orderList.value[activeStore.value].paid = 1; orderList.value[activeStore.value].paid = 1;
}); });
dialogVisible.value = true;
mitt.on("new_order", ()=>{
if(route.name == "order"){
dialogVisible.value = true;
}
});
}); });
onUnmounted(()=>{ onUnmounted(() => {
mitt.off("update-c-order-detail"); mitt.off("update-sale-order-detail");
mitt.off("new_order");
}) })
</script> </script>
@ -132,130 +108,73 @@ onUnmounted(()=>{
<div class="my-order"> <div class="my-order">
<div class="header-nav"> <div class="header-nav">
<div class="nav-item"> <div class="nav-item">
{{ "待提交采购订单" }} {{ "线上订单" }}
</div> </div>
<div class="nav-item-btn"> <div class="nav-item-btn">
<!-- <el-radio-group <el-radio-group v-model="tabPosition" @change="changeTabPosition" size="small">
v-model="tabPosition" <el-radio-button :value="1">全部</el-radio-button>
@change="changeTabPosition"
size="small"
>
<el-radio-button :value="1">已支付</el-radio-button>
<el-radio-button :value="2">未支付</el-radio-button> <el-radio-button :value="2">未支付</el-radio-button>
</el-radio-group> --> </el-radio-group>
<el-date-picker <el-date-picker v-model="date" type="daterange" start-placeholder="开始时间" end-placeholder="结束时间"
v-model="where.date" size="small" value-format="YYYY/MM/DD" :disabled-date="disabledDate" @change="changeDate"
type="date"
placeholder="请选择时间"
size="small"
:clearable="false" :clearable="false"
value-format="YYYY-MM-DD" style="width: 14rem; margin-left: 1rem" />
:disabled-date="disabledDate"
@change="changeDate"
/>
</div> </div>
</div> </div>
<div class="header-input"> <div class="header-input">
<el-input <el-input v-model="where.order_id" placeholder="请输入订单编号" @keydown.enter="getOrderList(true)"
v-model="where.number" @clear="getOrderList(true)" clearable>
placeholder="请输入订单编号"
@keydown.enter="getOrderList(true)"
@clear="getOrderList(true)"
clearable
>
<template #append> <template #append>
<el-button <el-button type="primary" style="
type="primary"
style="
background-color: #1890ff; background-color: #1890ff;
color: #fff; color: #fff;
border-radius: 0 0.315rem 0.315rem 0; border-radius: 0 0.315rem 0.315rem 0;
" " @click="getOrderList(true)">搜索</el-button>
@click="getOrderList(true)"
>搜索</el-button
>
</template> </template>
</el-input> </el-input>
</div> </div>
<div <div class="order-lists" v-loading="loading" v-infinite-scroll="getOrderList" :infinite-scroll-distance="300"
class="order-lists" :infinite-scroll-delay="500" style="overflow: auto">
v-loading="loading" <div class="item" :class="{ 'item-active': activeStore == index }" v-for="(item, index) in orderList"
v-infinite-scroll="getOrderList" :key="index" @click="setForm(item, index)">
:infinite-scroll-distance="300"
:infinite-scroll-delay="500"
style="overflow: auto"
>
<div
class="item"
:class="{ 'item-active': activeStore == index }"
v-for="(item, index) in orderList"
:key="index"
@click="setForm(item, index)"
>
<div class="top"> <div class="top">
<div class="sn">单号: {{ item.number }}</div> <div class="sn" :class="'cahier'">单号: {{ item.order_id }}</div>
<div class="create-time">{{ item.create_time }}</div> <div class="create-time">{{ item.pay_time }}</div>
</div> </div>
<div class="shop"> <div class="shop">
<div class="left" v-if="item.goods_list"> <div class="left" v-if="item.product_info">
<el-image <el-image v-for="(shop, imgkey) in item.product_info.slice(0, 5)" :key="imgkey"
v-for="(shop, imgkey) in item.goods_list.slice(0, 5)" :src="shop.image" class="shop-img"></el-image>
:key="imgkey" <div v-if="item.product_info.length == 1" class="shop-name">
:src="shop.imgs" {{ item.product_info[0].store_name }}
class="shop-img"
></el-image>
<div v-if="item.goods_list.length == 1" class="shop-name">
{{ item.goods_list[0].class_name }}
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div class="money">¥{{ item.total }}</div> <div class="money">¥{{ item.pay_price }}</div>
<div class="count">{{ item.goods_count }}款商品</div> <div class="count">{{ item.product_info.length }}款商品</div>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="pay"> <div class="pay">
<div v-if="item.paid"> <div v-if="item.paid">
已支付 {{ item.paid_name }}
<span v-if="item.pay_type == 9">(微信收款)</span> <span v-if="item.pay_type == 9">(微信收款)</span>
<span v-if="item.pay_type == 17">(现金支付)</span>
<span v-if="item.pay_type == 13">(支付宝收款)</span>
<span v-if="item.pay_type == 3">(余额支付)</span> <span v-if="item.pay_type == 3">(余额支付)</span>
<span v-if="item.pay_type == 1">(微信支付)</span> <span v-if="item.pay_type == 1">(微信支付)</span>
</div> </div>
<div v-else style="color: #ff4a00">未支付</div> <div v-else style="color: #ff4a00">{{ item.paid_name }}</div>
</div> </div>
<!-- <div class="cashier" v-if="item.service_info"> <!-- <div class="cashier" v-if="item.service_info">
收银员: {{ item.service_info.nickname }} 收银员: {{ item.service_info.nickname }}
</div> </div>
<div class="cashier" v-else>平台订单</div> --> <div class="cashier" v-else>平台订单</div> -->
<div class="cashier" v-if="!item.address_id">
<el-button size="small" type="primary" @click.stop="addAddress(item)">添加收货地址</el-button>
</div>
</div> </div>
</div> </div>
<div v-if="loadEnd" class="load-end">没有更多了</div> <div v-if="loadEnd" class="load-end">没有更多了</div>
<div v-if="loading" class="load-end">加载中...</div> <div v-if="loading" class="load-end">加载中...</div>
<div style="width: 100%; height: 7rem"></div>
</div> </div>
<div class="bottom-btn-fiexd" v-if="!loading">
<el-button class="btn" type="primary" @click="submitOrder" :disabled="!orderList.length">
提交采购</el-button
>
</div>
<el-dialog
v-model="dialogVisible"
title="您有新的订单,是否立即刷新"
width="500"
:before-close="handleClose"
>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">稍后刷新</el-button>
<el-button type="primary" @click="getOrderList(true)">
立即刷新
</el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>
@ -278,35 +197,43 @@ onUnmounted(()=>{
span { span {
color: #ff4a00; color: #ff4a00;
} }
.nav-item { .nav-item {
font-weight: bold; font-weight: bold;
} }
.nav-item-btn { .nav-item-btn {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
} }
.header-input { .header-input {
padding: 1rem; padding: 1rem;
padding-top: 0; padding-top: 0;
height: 2.5rem; height: 2.5rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
.order-lists { .order-lists {
height: calc(100vh - 100px - 10.2rem); height: calc(100vh - 100px - 10.2rem);
overflow-y: auto; overflow-y: auto;
.item { .item {
padding: 1rem; padding: 1rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
.top { .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
.sn { .sn {
font-weight: bold; font-weight: bold;
font-size: 0.9rem; font-size: 0.9rem;
} }
.cahier { .cahier {
&::before { &::before {
content: "收银"; content: "收银";
@ -319,6 +246,7 @@ onUnmounted(()=>{
border-radius: 0.187rem; border-radius: 0.187rem;
} }
} }
.cahier2 { .cahier2 {
&::before { &::before {
content: "平台"; content: "平台";
@ -331,38 +259,46 @@ onUnmounted(()=>{
border-radius: 0.187rem; border-radius: 0.187rem;
} }
} }
.create-time { .create-time {
font-size: 0.8rem; font-size: 0.8rem;
} }
} }
.shop { .shop {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.right { .right {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.money { .money {
font-size: 1rem; font-size: 1rem;
color: #ff4a00; color: #ff4a00;
font-weight: bold; font-weight: bold;
} }
.count { .count {
font-size: 0.7rem; font-size: 0.7rem;
color: #999; color: #999;
} }
} }
.left { .left {
height: 4.5rem; height: 4.5rem;
display: flex; display: flex;
align-items: center; align-items: center;
.shop-img { .shop-img {
width: 3.5rem; width: 3.5rem;
height: 3.5rem; height: 3.5rem;
border-radius: 0.3rem; border-radius: 0.3rem;
margin-right: 0.4rem; margin-right: 0.4rem;
} }
.shop-name { .shop-name {
font-size: 0.9rem; font-size: 0.9rem;
color: #333; color: #333;
@ -374,11 +310,13 @@ onUnmounted(()=>{
} }
} }
} }
.bottom { .bottom {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 0.9rem; font-size: 0.9rem;
color: #777; color: #777;
.manage-btn { .manage-btn {
color: #fff; color: #fff;
background-color: #e6a23c; background-color: #e6a23c;
@ -388,33 +326,17 @@ onUnmounted(()=>{
} }
} }
} }
.item-active { .item-active {
background-color: #efefef; background-color: #efefef;
} }
} }
.load-end { .load-end {
text-align: center; text-align: center;
padding: 1rem; padding: 1rem;
color: #333; color: #333;
font-size: 0.8rem; font-size: 0.8rem;
} }
.bottom-btn-fiexd {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
border-top: 1px solid #eee;
background-color: #fff;
z-index: 100;
height: 5.2rem;
padding: 1rem 1.5rem;
.btn {
width: 100%;
height: 100%;
font-size: 1.2rem;
border-radius: 3rem;
}
}
} }
</style> </style>

View File

@ -3,85 +3,15 @@ import order from "./component/order.vue";
import detail from "./component/detail.vue"; import detail from "./component/detail.vue";
import padding from "@/components/padding.vue"; import padding from "@/components/padding.vue";
import { ref, nextTick } from "vue"; import { ref, nextTick } from "vue";
import { merchantCreateApi } from "@/api/store";
const orderRef = ref(null);
const dialogFormVisible = ref(false);
const addAddress = (e) => {
if (e.id != form.value.order_id) {
form.value = {
real_name: "",
phone: "",
detail: "",
order_id: e.id,
};
} else form.value.order_id = e.id;
dialogFormVisible.value = true;
};
const form = ref({
real_name: "",
phone: "",
detail: "",
order_id: "",
});
const rules = ref({
real_name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
phone: [{ required: true, message: "请输入手机号", trigger: "blur" }],
detail: [{ required: true, message: "请输入地址", trigger: "blur" }],
});
const formRef = ref(null);
const submit = () => {
formRef.value?.validate((valid) => {
if (valid) {
merchantCreateApi(form.value).then((res) => {
dialogFormVisible.value = false;
orderRef.value?.getOrderList(true);
});
}
});
};
</script> </script>
<template> <template>
<div class="my-card"> <div class="my-card">
<order style="flex-shrink: 0" ref="orderRef" @addAddress="addAddress" /> <order style="flex-shrink: 0;" ref="orderRef"/>
<padding /> <padding />
<detail ref="detailRef" @addAddress="addAddress" /> <detail ref="detailRef"/>
<el-dialog v-model="dialogFormVisible" title="添加地址" width="500">
<el-form ref="formRef" :model="form" label-width="100" :rules="rules">
<el-form-item
label="收货人"
:label-width="formLabelWidth"
prop="real_name"
>
<el-input
v-model="form.real_name"
autocomplete="off"
placeholder="请输入收货人"
/>
</el-form-item>
<el-form-item label="电话" :label-width="formLabelWidth" prop="phone">
<el-input
v-model="form.phone"
type="number"
placeholder="请输入电话"
/>
</el-form-item>
<el-form-item label="地址" :label-width="formLabelWidth" prop="detail">
<el-input v-model="form.detail" placeholder="请输入地址" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="submit"> 确认 </el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>

View File

@ -1,146 +1,36 @@
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import { import { amountTakingListsApi, financialRecordApi } from "@/api/merchant.js";
orderListApi,
orderStatusApi,
orderLadingApi,
cartListApi,
statisticsApi,
orderPriceApi,
} from "@/api/store.js";
import { useUserStore } from "@/store/user.js";
import pay from "@/components/pay.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
import moment from "moment";
const userStore = useUserStore();
const orderList = ref([]); const orderList = ref([]);
const router = useRouter();
const tabPosition = ref(1); // 1-, 2-
const payRef = ref(null);
const where = ref({ const where = ref({
page_no: 1, page_no: 1,
page_size: 15, page_size: 15,
staff_id: userStore.userInfo.service.service_id,
}); });
const loading = ref(false); const loading = ref(false);
const total = ref(0);
const getOrderList = () => { const getOrderList = () => {
orderPriceApi(userStore.userInfo.service.mer_id, where.value).then((res) => { financialRecordApi(where.value).then((res) => {
orderList.value = res.data; orderList.value = res.data.lists;
// total.value = res.data.count;
}); });
}; };
getOrderList(); getOrderList();
const formData = ref({});
const getStatistics = () => {
loading.value = true;
statisticsApi(userStore.userInfo.service.mer_id, {
staff_id: userStore.userInfo.service.service_id,
}).then((res) => {
formData.value = res.data.data;
loading.value = false;
});
};
getStatistics();
const prevClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const nextClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const currentChange = (e) => {
where.value.page_no = e;
getOrderList();
};
const cellClick = (row, column) => {
let date = '';
let query = {}
if(Number(moment(row.day).format('MM')) > Number(moment().format('MM'))){
let year = moment().format('YYYY');
date = (year-1) + '-' + row.day.split('-').join('-');
}else {
let year = moment().format('YYYY');
date = year + '-' + row.day.split('-').join('-');
}
query.date = date;
if(column.no==2) query.payType = 1;
if(column.no==3) query.payType = 2;
router.push({
path: "order",
query: query
})
}
</script> </script>
<template> <template>
<div v-loading="loading" element-loading-text="加载中" class="my-order"> <div v-loading="loading" element-loading-text="加载中" class="my-order">
<div class="from" v-if="formData.today">
<!-- <div class="form-card green">
<div>{{ formData.today.payPrice }}</div>
<div class="tips">今日线上收银金额</div>
</div>
<div class="form-card green">
<div>{{ formData.yesterday.payPrice }}</div>
<div class="tips">昨日线上收银金额</div>
</div>
<div class="form-card green">
<div>{{ formData.month.payPrice }}</div>
<div class="tips">本月线上收银金额</div>
</div> -->
<div class="form-card">
<div>{{ (formData.today.cashPayment + formData.today.payPrice).toFixed(2) }}</div>
<div class="tips">今日收银 平台+线上+现金 总金额</div>
</div>
<div class="form-card">
<div>
{{ (formData.yesterday.cashPayment + formData.yesterday.payPrice).toFixed(2) }}
</div>
<div class="tips">昨日收银 平台+线上+现金 总金额</div>
</div>
<div class="form-card">
<div>{{ (formData.month.cashPayment + formData.month.payPrice).toFixed(2) }}</div>
<div class="tips">本月收银 平台+线上+现金 总金额</div>
</div>
<!-- <div class="form-card red">
<div>{{ formData.today.cashPayment }}</div>
<div class="tips">今日现金收银金额</div>
</div>
<div class="form-card red">
<div>{{ formData.yesterday.cashPayment }}</div>
<div class="tips">昨日现金收银金额</div>
</div>
<div class="form-card red">
<div>{{ formData.month.cashPayment }}</div>
<div class="tips">本月现金收银金额</div>
</div> -->
</div>
<div class="table"> <div class="table">
<el-table :data="orderList" style="width: 100%" @cell-click="cellClick"> <el-table :data="orderList" style="width: 100%">
<el-table-column prop="day" label="日期" width="260" /> <el-table-column prop="record_date" label="时间" width="260" />
<el-table-column prop="total" label="订单数量" /> <el-table-column prop="cashier_cash_total_amount" label="现金收银金额(元)" />
<el-table-column prop="cash_payment" label="现金收银金额" /> <el-table-column prop="cashier_total_amount" label="线上收银金额(元)" />
<el-table-column prop="cash_registe" label="线上收银金额" /> <el-table-column prop="platofrm_total_amount" label="平台订单金额(元)" />
<el-table-column prop="pay_price" label="平台交易额" /> <el-table-column prop="total_amount" label="总金额(元)" />
<el-table-column label="总金额">
<template #default="scope">
{{ (((+scope.row.pay_price || 0) + (+scope.row.cash_payment || 0))).toFixed(2) }}
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
@ -157,7 +47,7 @@ const cellClick = (row, column) => {
width: 100%; width: 100%;
padding-bottom: 1.25rem; padding-bottom: 1.25rem;
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); /* 六列 */ grid-template-columns: repeat(5, 1fr); /* 六列 */
gap: 1.25rem; /* 列间距 */ gap: 1.25rem; /* 列间距 */
.form-card { .form-card {
@ -189,7 +79,6 @@ const cellClick = (row, column) => {
box-sizing: border-box; box-sizing: border-box;
padding: 1rem; padding: 1rem;
overflow-y: scroll; overflow-y: scroll;
cursor: pointer;
} }
} }
/* 修改滚动条的样式 */ /* 修改滚动条的样式 */

View File

@ -1,238 +0,0 @@
<script setup>
import { ref } from "vue";
import {
orderListApi,
orderStatusApi,
orderLadingApi,
cartListApi
} from "@/api/store.js";
import { useUserStore } from "@/store/user.js";
import pay from "@/components/pay.vue";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
const userStore = useUserStore();
const orderList = ref([]);
const router = useRouter();
const tabPosition = ref(1); // 1-, 2-
const payRef = ref(null);
const where = ref({
page_no: 1,
page_size: 20,
});
const loading = ref(false);
const total = ref(0);
const getOrderList = () => {
loading.value = true;
if (tabPosition.value == 1) where.value.paid = null;
if (tabPosition.value == 2) where.value.paid = 0;
orderListApi(userStore.userInfo.service.mer_id, where.value).then((res) => {
orderList.value = res.data.list;
total.value = res.data.count;
loading.value = false;
});
};
getOrderList();
const cartCount = ref(0);
const getCartList = () => {
cartListApi({
staff_id: userStore.userInfo.service.service_id,
}).then((res) => {
cartCount.value = res.data.list?.length;
});
};
getCartList();
const changeTabPosition = (e) => {
where.value.page_no = 1;
getOrderList();
};
const prevClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const nextClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const currentChange = (e) => {
where.value.page_no = e;
getOrderList();
};
const paySuccess = () => {
getOrderList();
};
const rePay = (row) => {
payRef.value.setRePay({
price: row.pay_price,
order_id: row.group_order_id,
});
payRef.value.drawer = true;
};
const getOrderStatus = (id) => {
orderStatusApi({
order_sn: id,
})
.then((res) => {
if (res.data.paid == 1 || res.message == "支付成功") {
ElMessage({
message: res.message,
type: "success",
});
getOrderList();
} else {
ElMessage({
message: res.message,
type: "error",
});
}
})
.catch((err) => {});
};
const orderLadingSn = ref('')
const orderLading = () => {
dialogVisible.value = false;
orderLadingApi({
order_sn: orderLadingSn.value,
}).then((res) => {
ElMessage({
message: res.message,
type: "success",
});
router.push({
name: "home",
});
});
};
const dialogVisible = ref(false);
const orderLadingComfirm = (order_sn)=>{
orderLadingSn.value = order_sn;
dialogVisible.value = true;
}
const goHome = ()=>{
router.push({
name: "home",
});
}
</script>
<template>
<div v-loading="loading" element-loading-text="加载中" class="my-order">
<el-radio-group
v-model="tabPosition"
style="margin-bottom: 30px"
@change="changeTabPosition"
>
<el-radio-button :value="1">全部</el-radio-button>
<el-radio-button :value="2">未支付</el-radio-button>
</el-radio-group>
<el-table :data="orderList" style="width: 100%">
<el-table-column prop="group_order_id" label="ID" width="100" />
<el-table-column prop="order_sn" label="订单号" width="260" />
<el-table-column prop="total_price" label="订单金额" />
<el-table-column prop="paid" label="支付状态">
<template #default="scope">
<span v-if="scope.row.paid == 1">已支付</span>
<span v-else style="color: #ff4a00">未支付</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="订单创建时间" />
<el-table-column prop="pay_time" label="订单支付时间">
<template #default="scope">
<span v-if="scope.row.pay_time">{{ scope.row.pay_time }}</span>
<div v-else class="flex">
<el-button type="primary" link @click="rePay(scope.row)"
>重新支付</el-button
>
<el-button
type="primary"
link
@click="getOrderStatus(scope.row.order_sn)"
>检测状态</el-button
>
<el-button
type="primary"
link
@click="orderLadingComfirm(scope.row.order_sn)"
>提单</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
:page_no-size="where.page_size"
layout="prev, pager, next"
:total="total"
@prev-click="prevClick"
@next-click="nextClick"
@current-change="currentChange"
/>
<pay ref="payRef" @paySuccess="paySuccess" />
<el-dialog
v-model="dialogVisible"
title="提示"
width="500"
>
<span>提单前请清空购物车, 避免提单的商品与购物车商品混合, 请确保购物车内无数据后再进行提单</span>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-if="cartCount>0" @click="goHome">
前去清空购物车
</el-button>
<el-button v-else type="primary" @click="orderLading">
确认提单
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss" scoped>
.my-order {
background-color: #fff;
border-radius: 1.2rem;
box-sizing: border-box;
padding: 1rem;
overflow-y: scroll;
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
width: 0.315rem; /* 设置滚动条的宽度 */
}
/* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */
margin: 1.25rem 0;
}
/* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */
border-radius: 0.315rem; /* 设置滑块的圆角 */
}
/* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
}
</style>

View File

@ -1,43 +0,0 @@
<script setup>
import order from "./component/order.vue";
import detail from "./component/detail.vue";
import padding from "@/components/padding.vue";
import { ref, nextTick } from "vue";
</script>
<template>
<div class="my-card">
<order style="flex-shrink: 0;" ref="orderRef" isSystem/>
<padding />
<detail ref="detailRef"/>
</div>
</template>
<style lang="scss">
.my-card {
display: flex;
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
width: 0.315rem; /* 设置滚动条的宽度 */
}
/* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */
/* margin: 1.25rem 0; */
}
/* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */
border-radius: 0.315rem; /* 设置滑块的圆角 */
}
/* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
}
</style>

View File

@ -133,6 +133,7 @@ onUnmounted(()=>{
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
:disabled-date="disabledDate" :disabled-date="disabledDate"
@change="changeDate" @change="changeDate"
:clearable="false"
/> />
</div> </div>
</div> </div>

View File

@ -13,22 +13,22 @@ const discounts = ref(0); //优惠金额
const userStore = useUserStore(); const userStore = useUserStore();
const clearAll = () => { const clearAll = () => {
let cart_id = []; let id = [];
list.value.map((item) => { list.value.map((item) => {
cart_id.push(item.cart_id); id.push(item.id);
}); });
if (cart_id.length == 0) return; if (id.length == 0) return;
deleteShop(cart_id); deleteShop(id);
}; };
const deleteOne = (cart_id) => { const deleteOne = (id) => {
list.value = list.value.filter((item) => item.cart_id != cart_id); list.value = list.value.filter((item) => item.id != id);
deleteShop([cart_id]); deleteShop([id]);
}; };
const deleteShop = (arr) => { const deleteShop = (arr) => {
cartDeleteApi({ cartDeleteApi({
cart_id: arr, id: arr,
}).then((res) => { }).then((res) => {
console.log(res); console.log(res);
getList(); getList();
@ -42,7 +42,9 @@ const getList = () => {
cartListApi().then((res) => { cartListApi().then((res) => {
if (res.data?.lists?.length > 0) { if (res.data?.lists?.length > 0) {
list.value = res.data.lists; list.value = res.data.lists;
allPrice.value = +res.data.extend.total_price; allPrice.value = res.data?.lists.reduce((previous, current) => {
return previous + Number(current.total_price);
}, 0)
costPrice.value = allPrice.value; costPrice.value = allPrice.value;
} else list.value = []; } else list.value = [];
}); });
@ -57,13 +59,12 @@ const goPay = () => {
const changeCartNum = (val, old) => { const changeCartNum = (val, old) => {
cartCreateApi({ cartCreateApi({
goods_id: val.goods_id, product_id: val.product_id,
is_new: 0,
cart_num: val.cart_num cart_num: val.cart_num
}).then((res) => { }).then((res) => {
allPrice.value = 0; allPrice.value = 0;
list.value.forEach((item) => { list.value.forEach((item) => {
allPrice.value += item.sell*item.cart_num; allPrice.value += item.price*item.cart_num;
}); });
costPrice.value = allPrice.value; costPrice.value = allPrice.value;
}); });
@ -132,19 +133,19 @@ onUnmounted(() => {
<el-image <el-image
loading="lazy" loading="lazy"
class="order-item-img" class="order-item-img"
:src="item.imgs" :src="item.image"
></el-image> ></el-image>
<div class="order-item-info"> <div class="order-item-info">
<div class="order-item-title"> <div class="order-item-title">
<div class="title">{{ item.goods_name }}</div> <div class="title">{{ item.store_name }}</div>
<div class="delete" @click="deleteOne(item.cart_id)">删除</div> <div class="delete" @click="deleteOne(item.id)">删除</div>
</div> </div>
<div class="order-item-sku"> <div class="order-item-sku">
<span>{{ item.unit_name }}</span> <span>{{ item.unit_name }}</span>
</div> </div>
<div class="order-item-price"> <div class="order-item-price">
<div> <div>
¥<span>{{ item.sell }}</span> ¥<span>{{ item.price }}</span>
</div> </div>
<div> <div>
<el-input-number <el-input-number

View File

@ -54,12 +54,12 @@ const close = () => {
<div class="shop" v-loading="loading"> <div class="shop" v-loading="loading">
<div class="shop-info"> <div class="shop-info">
<div class="shop-info-left"> <div class="shop-info-left">
<el-image loading="lazy" :src="form.imgs"></el-image> <el-image loading="lazy" :src="form.image"></el-image>
</div> </div>
<div class="shop-info-right"> <div class="shop-info-right">
<div class="shop-info-right-top">{{ form.name }}</div> <div class="shop-info-right-top">{{ form.store_name }}</div>
<div class="shop-info-right-price"> <div class="shop-info-right-price">
¥<span>{{ form.sell }}</span ¥<span>{{ form.price }}</span
><span style="font-size: 1rem; color: #777"> ><span style="font-size: 1rem; color: #777">
/ {{ form.unit_name }}</span / {{ form.unit_name }}</span
> >

View File

@ -23,7 +23,7 @@ const name = ref("");
const loadMore = () => { const loadMore = () => {
emit("loadMore", { emit("loadMore", {
name: name.value, store_name_code: name.value,
}); });
}; };
@ -34,9 +34,11 @@ const changeItem = (item) => {
}; };
const handleEnter = _.throttle(() => { const handleEnter = _.throttle(() => {
let obj = {} let obj = {
if(/^\d+$/.test(name.value)) obj.code = name.value; store_name_code: name.value,
else obj.name = name.value; }
// if(/^\d+$/.test(name.value)) obj.code = name.value;
// else obj.name = name.value;
emit("getStoreList", obj, true); emit("getStoreList", obj, true);
}, 300) }, 300)
@ -112,10 +114,10 @@ onUnmounted(() => {
:key="index" :key="index"
@click="changeItem(item)" @click="changeItem(item)"
> >
<el-image loading="lazy" :src="item.imgs"></el-image> <el-image loading="lazy" :src="item.image"></el-image>
<div class="shop-name">{{ item.name }}</div> <div class="shop-name">{{ item.store_name }}</div>
<div class="shop-price"> <div class="shop-price">
¥<span>{{ item.sell }}</span> ¥<span>{{ item.price }}</span>
<span class="unit-name">/{{item.unit_name}}</span> <span class="unit-name">/{{item.unit_name}}</span>
</div> </div>
<div class="no-stock" v-if="item.stock == 0"> <div class="no-stock" v-if="item.stock == 0">

View File

@ -70,8 +70,7 @@ function isAllDigits(str) {
const cartAddInfo = (item, change = "") => { const cartAddInfo = (item, change = "") => {
console.log(item, change); console.log(item, change);
let q = { let q = {
goods_id: item.id, product_id: item.product_id,
is_new: 0,
cart_num: item.cart_num, cart_num: item.cart_num,
}; };
cartCreateApi(q).then((res) => { cartCreateApi(q).then((res) => {
@ -92,7 +91,7 @@ const editPupop = (item) => {
const orderForm = ref({}); const orderForm = ref({});
// //
const checkOut = () => { const checkOut = () => {
let cart_id = orderRef.value.list.map((item) => item.cart_id); let cart_id = orderRef.value.list.map((item) => item.id);
let query = { let query = {
cart_id: cart_id, cart_id: cart_id,
}; };
@ -121,7 +120,7 @@ const paySuccess = (data = null) => {
// trade_type: "MICROPAY", // // trade_type: "MICROPAY", //
// transaction_id: "4200002159202405159003084211", // // transaction_id: "4200002159202405159003084211", //
// } // }
if(data) onPrint(data); // if(data) onPrint(data);
setTimeout(()=>{ setTimeout(()=>{
orderRef.value.getList(); orderRef.value.getList();
}) })
@ -143,8 +142,8 @@ const onPrint = (data)=>{
if(data.pay_type==13) paytype = "支付宝支付"; if(data.pay_type==13) paytype = "支付宝支付";
if(data.pay_type==9) paytype = "微信支付"; if(data.pay_type==9) paytype = "微信支付";
let obj = { let obj = {
mer_name: userStore.userInfo.merchant.mer_name, // mer_name: userStore.userInfo.mer_name, //
service_phone: userStore.userInfo.merchant.service_phone, // service_phone: userStore.userInfo.service_phone, //
number: data.out_trade_no, // number: data.out_trade_no, //
create_time: data.create_time, // create_time: data.create_time, //
total_price: orderForm.value.total, // total_price: orderForm.value.total, //

View File

@ -6,6 +6,7 @@ import {
orderLadingApi, orderLadingApi,
cartListApi, cartListApi,
cashierinfoListApi, cashierinfoListApi,
cashierinfoDetailsApi
} from "@/api/store.js"; } from "@/api/store.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
@ -78,7 +79,7 @@ const getOrderStatus = (id) => {
}); });
} }
}) })
.catch((err) => {}); .catch((err) => { });
}; };
const where = ref({ const where = ref({
@ -107,14 +108,32 @@ const getOrderList = () => {
} }
}; };
const getDetail = () => {
loading.value = true;
cashierinfoDetailsApi({
id: formData.value.id,
}).then(res => {
formData.value = res.data;
setTimeout(() => {
loading.value = false;
}, 200)
})
}
const repay = ()=>{
}
onMounted(() => { onMounted(() => {
mitt.on("set-sale-order-detail", (res) => { mitt.on("set-sale-order-detail", (res) => {
console.log("===", res);
formData.value = res; formData.value = res;
where.value.page_no = 1; where.value.page_no = 1;
where.value.loadend = false; where.value.loadend = false;
where.value.loading = false; where.value.loading = false;
goods_list.value = []; goods_list.value = [];
getOrderList(); getDetail();
// getOrderList();
}); });
}); });
@ -125,33 +144,26 @@ onUnmounted(() => {
<template> <template>
<div class="my-order"> <div class="my-order">
<div class="detail" v-loading="loading"> <div class="detail" v-if="formData.id" v-loading="loading">
<div <div class="table" v-infinite-scroll="getOrderList" :infinite-scroll-distance="300"
class="table" :infinite-scroll-delay="300" style="overflow: auto" :infinite-scroll-immediate="false">
v-loading="loading"
v-infinite-scroll="getOrderList"
:infinite-scroll-distance="300"
:infinite-scroll-delay="300"
style="overflow: auto"
:infinite-scroll-immediate="false"
>
<div class="table-title">订单信息</div> <div class="table-title">订单信息</div>
<div class="table-info"> <div class="table-info">
<div class="info-item"> <div class="info-item">
<div class="info-item-title">订单编号:</div> <div class="info-item-title">订单编号:</div>
<div class="info-item-info">{{ formData.number }}</div> <div class="info-item-info">{{ formData.order_id }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品款数:</div> <div class="info-item-title">商品款数:</div>
<div class="info-item-info">{{ formData.goods_count }}</div> <div class="info-item-info">{{ formData.total_num || 0 }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">商品总价:</div> <div class="info-item-title">商品总价:</div>
<div class="info-item-info">¥{{ formData.total }}</div> <div class="info-item-info">¥{{ formData.total_price }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">创建时间:</div> <div class="info-item-title">创建时间:</div>
<div class="info-item-info">{{ formData.create_time }}</div> <div class="info-item-info">{{ formData.pay_time }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">优惠抵扣:</div> <div class="info-item-title">优惠抵扣:</div>
@ -159,16 +171,18 @@ onUnmounted(() => {
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">实际支付:</div> <div class="info-item-title">实际支付:</div>
<div class="info-item-info">¥{{ formData.actual }}</div> <div class="info-item-info">¥{{ formData.pay_price }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付时间:</div> <div class="info-item-title">支付时间:</div>
<div class="info-item-info">{{ formData.update_time }}</div> <div class="info-item-info">{{ formData.pay_time }}</div>
</div> </div>
<div class="info-item"> <div class="info-item">
<div class="info-item-title">支付方式:</div> <div class="info-item-title">支付方式:</div>
<div class="info-item-info"> <div class="info-item-info">
<span v-if="formData.pay_type == 9">微信收款</span> <span v-if="formData.pay_type == 9">微信收款</span>
<span v-if="formData.pay_type == 17">现金支付</span>
<span v-if="formData.pay_type == 13">支付宝收款</span>
<span v-if="formData.pay_type == 3">余额支付</span> <span v-if="formData.pay_type == 3">余额支付</span>
<span v-if="formData.pay_type == 1">微信支付</span> <span v-if="formData.pay_type == 1">微信支付</span>
</div> </div>
@ -176,26 +190,29 @@ onUnmounted(() => {
</div> </div>
<div style="font-size: 0.9rem"> <div style="font-size: 0.9rem">
共计 共计
<span style="color: #ff4a00">{{ formData.goods_count }}</span> 款商品 <span style="color: #ff4a00">{{ formData.product?.length || " " }}</span> 款商品
</div> </div>
<el-table :data="goods_list"> <el-table :data="formData.product">
<el-table-column label="商品信息"> <el-table-column label="商品信息">
<template #default="{ row }"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-image <el-image style="height: 3rem; width: 3rem" :src="row.cart_info?.image"></el-image>
style="height: 3rem; width: 3rem" <span style="margin-left: 0.5rem">{{ row.cart_info?.name }}</span>
:src="row.imgs"
></el-image>
<span style="margin-left: 0.5rem">{{ row.goods_name }}</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price" label="单价" width="150" /> <el-table-column prop="cart_info.price" label="单价" width="150" />
<el-table-column prop="nums" label="数量" width="150" /> <el-table-column prop="cart_info.cart_num" label="数量" width="150" />
<el-table-column prop="total" label="总价" width="150"> <el-table-column prop="cart_info.total" label="总价" width="150">
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="footer" v-if="!formData.paid">
<el-button type="primary" size="large" @click="repay">重新支付</el-button>
</div>
</div>
<div v-else>
<el-empty></el-empty>
</div> </div>
</div> </div>
</template> </template>
@ -210,7 +227,7 @@ onUnmounted(() => {
overflow: hidden; overflow: hidden;
.detail { .detail {
height: calc(100vh - 100px - 4rem); height: 100%;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
@ -223,6 +240,7 @@ onUnmounted(() => {
.table-title { .table-title {
font-weight: bold; font-weight: bold;
} }
.table-info { .table-info {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -240,6 +258,7 @@ onUnmounted(() => {
width: 33%; width: 33%;
display: flex; display: flex;
padding-top: 1rem; padding-top: 1rem;
.info-item-title { .info-item-title {
flex-shrink: 0; flex-shrink: 0;
padding-right: 1rem; padding-right: 1rem;
@ -247,6 +266,21 @@ onUnmounted(() => {
} }
} }
} }
.footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 6rem;
box-sizing: border-box;
background-color: #fff;
display: flex;
justify-content: flex-end;
align-items: center;
padding: 0 2rem;
border-top: 1px solid #eee;
} }
}
} }
</style> </style>

View File

@ -11,6 +11,7 @@ import { useUserStore } from "@/store/user.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import mitt from "@/utils/mitt.js"; import mitt from "@/utils/mitt.js";
import moment from "moment";
const userStore = useUserStore(); const userStore = useUserStore();
const props = defineProps({ const props = defineProps({
@ -39,7 +40,8 @@ const payRef = ref(null);
const date = ref(""); const date = ref("");
const changeDate = () => { const changeDate = () => {
where.value.date = date.value.join("-"); where.value.start_time = moment(date.value[0]).format('YYYY-MM-DD 00:00:00');
where.value.end_time = moment(date.value[1]).format('YYYY-MM-DD 23:59:59');
getOrderList(true); getOrderList(true);
}; };
@ -51,9 +53,10 @@ const disabledDate = (time)=>{
const where = ref({ const where = ref({
page_no: 1, page_no: 1,
page_size: 20, page_size: 20,
number: "", order_id: "",
date: "", start_time: "",
source: props.source, end_time: "",
is_sashier: 1, // 1-, 2-
}); });
const loading = ref(false); const loading = ref(false);
@ -125,13 +128,14 @@ onUnmounted(()=>{
value-format="YYYY/MM/DD" value-format="YYYY/MM/DD"
:disabled-date="disabledDate" :disabled-date="disabledDate"
@change="changeDate" @change="changeDate"
:clearable="false"
style="width: 14rem; margin-left: 1rem" style="width: 14rem; margin-left: 1rem"
/> />
</div> </div>
</div> </div>
<div class="header-input"> <div class="header-input">
<el-input <el-input
v-model="where.number" v-model="where.order_id"
placeholder="请输入订单编号" placeholder="请输入订单编号"
@keydown.enter="getOrderList(true)" @keydown.enter="getOrderList(true)"
@clear="getOrderList(true)" @clear="getOrderList(true)"
@ -167,36 +171,37 @@ onUnmounted(()=>{
@click="setForm(item, index)" @click="setForm(item, index)"
> >
<div class="top"> <div class="top">
<div class="sn" :class="'cahier'">单号: {{ item.number }}</div> <div class="sn" :class="'cahier'">单号: {{ item.order_id }}</div>
<div class="create-time">{{ item.create_time }}</div> <div class="create-time">{{ item.pay_time }}</div>
</div> </div>
<div class="shop"> <div class="shop">
<div class="left" v-if="item.goods_list"> <div class="left" v-if="item.product_info">
<el-image <el-image
v-for="(shop, imgkey) in item.goods_list.slice(0, 5)" v-for="(shop, imgkey) in item.product_info.slice(0, 5)"
:key="imgkey" :key="imgkey"
:src="shop.imgs" :src="shop.image"
class="shop-img" class="shop-img"
></el-image> ></el-image>
<div v-if="item.goods_list.length == 1" class="shop-name"> <div v-if="item.product_info.length == 1" class="shop-name">
{{ item.goods_list[0].class_name }} {{ item.product_info[0].store_name }}
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<div class="money">¥{{ item.total }}</div> <div class="money">¥{{ item.pay_price }}</div>
<div class="count">{{ item.goods_count }}款商品</div> <div class="count">{{ item.product_info.length }}款商品</div>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="pay"> <div class="pay">
<div v-if="item.paid"> <div v-if="item.paid">
已支付 {{ item.paid_name }}
<span v-if="item.pay_type == 9">(微信收款)</span> <span v-if="item.pay_type == 9">(微信收款)</span>
<span v-if="item.pay_type == 17">(现金支付)</span>
<span v-if="item.pay_type == 13">(支付宝收款)</span>
<span v-if="item.pay_type == 3">(余额支付)</span> <span v-if="item.pay_type == 3">(余额支付)</span>
<span v-if="item.pay_type == 1">(微信支付)</span> <span v-if="item.pay_type == 1">(微信支付)</span>
<!-- <span class="manage-btn">待处理</span> -->
</div> </div>
<div v-else style="color: #ff4a00">未支付</div> <div v-else style="color: #ff4a00">{{ item.paid_name }}</div>
</div> </div>
<!-- <div class="cashier" v-if="item.service_info"> <!-- <div class="cashier" v-if="item.service_info">
收银员: {{ item.service_info.nickname }} 收银员: {{ item.service_info.nickname }}

View File

@ -1,238 +0,0 @@
<script setup>
import { ref } from "vue";
import {
orderListApi,
orderStatusApi,
orderLadingApi,
cartListApi
} from "@/api/store.js";
import { useUserStore } from "@/store/user.js";
import pay from "@/components/pay.vue";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
const userStore = useUserStore();
const orderList = ref([]);
const router = useRouter();
const tabPosition = ref(1); // 1-, 2-
const payRef = ref(null);
const where = ref({
page_no: 1,
page_size: 20,
});
const loading = ref(false);
const total = ref(0);
const getOrderList = () => {
loading.value = true;
if (tabPosition.value == 1) where.value.paid = null;
if (tabPosition.value == 2) where.value.paid = 0;
orderListApi(userStore.userInfo.service.mer_id, where.value).then((res) => {
orderList.value = res.data.list;
total.value = res.data.count;
loading.value = false;
});
};
getOrderList();
const cartCount = ref(0);
const getCartList = () => {
cartListApi({
staff_id: userStore.userInfo.service.service_id,
}).then((res) => {
cartCount.value = res.data.list?.length;
});
};
getCartList();
const changeTabPosition = (e) => {
where.value.page_no = 1;
getOrderList();
};
const prevClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const nextClick = (e) => {
where.value.page_no = e;
getOrderList();
};
const currentChange = (e) => {
where.value.page_no = e;
getOrderList();
};
const paySuccess = () => {
getOrderList();
};
const rePay = (row) => {
payRef.value.setRePay({
price: row.pay_price,
order_id: row.group_order_id,
});
payRef.value.drawer = true;
};
const getOrderStatus = (id) => {
orderStatusApi({
order_sn: id,
})
.then((res) => {
if (res.data.paid == 1 || res.message == "支付成功") {
ElMessage({
message: res.message,
type: "success",
});
getOrderList();
} else {
ElMessage({
message: res.message,
type: "error",
});
}
})
.catch((err) => {});
};
const orderLadingSn = ref('')
const orderLading = () => {
dialogVisible.value = false;
orderLadingApi({
order_sn: orderLadingSn.value,
}).then((res) => {
ElMessage({
message: res.message,
type: "success",
});
router.push({
name: "home",
});
});
};
const dialogVisible = ref(false);
const orderLadingComfirm = (order_sn)=>{
orderLadingSn.value = order_sn;
dialogVisible.value = true;
}
const goHome = ()=>{
router.push({
name: "home",
});
}
</script>
<template>
<div v-loading="loading" element-loading-text="加载中" class="my-order">
<el-radio-group
v-model="tabPosition"
style="margin-bottom: 30px"
@change="changeTabPosition"
>
<el-radio-button :value="1">全部</el-radio-button>
<el-radio-button :value="2">未支付</el-radio-button>
</el-radio-group>
<el-table :data="orderList" style="width: 100%">
<el-table-column prop="group_order_id" label="ID" width="100" />
<el-table-column prop="order_sn" label="订单号" width="260" />
<el-table-column prop="total_price" label="订单金额" />
<el-table-column prop="paid" label="支付状态">
<template #default="scope">
<span v-if="scope.row.paid == 1">已支付</span>
<span v-else style="color: #ff4a00">未支付</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="订单创建时间" />
<el-table-column prop="pay_time" label="订单支付时间">
<template #default="scope">
<span v-if="scope.row.pay_time">{{ scope.row.pay_time }}</span>
<div v-else class="flex">
<el-button type="primary" link @click="rePay(scope.row)"
>重新支付</el-button
>
<el-button
type="primary"
link
@click="getOrderStatus(scope.row.order_sn)"
>检测状态</el-button
>
<el-button
type="primary"
link
@click="orderLadingComfirm(scope.row.order_sn)"
>提单</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
:page_no-size="where.page_size"
layout="prev, pager, next"
:total="total"
@prev-click="prevClick"
@next-click="nextClick"
@current-change="currentChange"
/>
<pay ref="payRef" @paySuccess="paySuccess" />
<el-dialog
v-model="dialogVisible"
title="提示"
width="500"
>
<span>提单前请清空购物车, 避免提单的商品与购物车商品混合, 请确保购物车内无数据后再进行提单</span>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-if="cartCount>0" @click="goHome">
前去清空购物车
</el-button>
<el-button v-else type="primary" @click="orderLading">
确认提单
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss" scoped>
.my-order {
background-color: #fff;
border-radius: 1.2rem;
box-sizing: border-box;
padding: 1rem;
overflow-y: scroll;
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
width: 0.315rem; /* 设置滚动条的宽度 */
}
/* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */
margin: 1.25rem 0;
}
/* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */
border-radius: 0.315rem; /* 设置滑块的圆角 */
}
/* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
}
</style>

View File

@ -1,43 +0,0 @@
<script setup>
import order from "./component/order.vue";
import detail from "./component/detail.vue";
import padding from "@/components/padding.vue";
import { ref, nextTick } from "vue";
</script>
<template>
<div class="my-card">
<!-- <order style="flex-shrink: 0;" ref="orderRef" isSystem/>
<padding />
<detail ref="detailRef"/> -->
</div>
</template>
<style lang="scss">
.my-card {
display: flex;
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
width: 0.315rem; /* 设置滚动条的宽度 */
}
/* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */
/* margin: 1.25rem 0; */
}
/* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */
border-radius: 0.315rem; /* 设置滑块的圆角 */
}
/* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
}
</style>

View File

@ -61,7 +61,7 @@ const show = (type, data) => {
}; };
const getProductDetail = (id) => { const getProductDetail = (id) => {
productDetailApi(userStore.userInfo.service.mer_id, id).then((res) => { productDetailApi(userStore.userInfo.service.store_id, id).then((res) => {
res.data.image = [ res.data.image = [
{ {
url: res.data.image, url: res.data.image,
@ -90,7 +90,7 @@ const getProductDetail = (id) => {
const categoryList = ref([]); const categoryList = ref([]);
const getCategoryList = () => { const getCategoryList = () => {
categoryListApi(userStore.userInfo.service.mer_id).then((res) => { categoryListApi(userStore.userInfo.service.store_id).then((res) => {
categoryList.value = res.data; categoryList.value = res.data;
}); });
}; };
@ -133,14 +133,14 @@ else data.cate_id = data.cate_id || '';
if (data.attrValue[0].stock<=0) return ElMessage.error("请输入商品库存"); if (data.attrValue[0].stock<=0) return ElMessage.error("请输入商品库存");
if (data.attrValue[0].price<=0) return ElMessage.error("请输入商品价格"); if (data.attrValue[0].price<=0) return ElMessage.error("请输入商品价格");
if (showType.value == "add") if (showType.value == "add")
productCreateApi(userStore.userInfo.service.mer_id, data).then((res) => { productCreateApi(userStore.userInfo.service.store_id, data).then((res) => {
ElMessage.success(res.message); ElMessage.success(res.message);
emit("reload", true); emit("reload", true);
beforeClose(); beforeClose();
}); });
else else
productUpdateApi( productUpdateApi(
userStore.userInfo.service.mer_id, userStore.userInfo.service.store_id,
data.product_id, data.product_id,
data data
).then((res) => { ).then((res) => {

View File

@ -23,7 +23,7 @@ const total = ref(0);
const productTitle = ref([]); const productTitle = ref([]);
const getProductTitleApi = () => { const getProductTitleApi = () => {
productTitleApi(userStore.userInfo.service.mer_id).then((res) => { productTitleApi(userStore.userInfo.service.store_id).then((res) => {
productTitle.value = res.data; productTitle.value = res.data;
}); });
}; };
@ -32,7 +32,7 @@ getProductTitleApi()
const getShopList = (loadmore = false) => { const getShopList = (loadmore = false) => {
loading.value = true; loading.value = true;
getProductTitleApi(); getProductTitleApi();
storeListApi(userStore.userInfo.service.mer_id, where.value).then((res) => { storeListApi(userStore.userInfo.service.store_id, where.value).then((res) => {
orderList.value = res.data.list; orderList.value = res.data.list;
total.value = res.data.count; total.value = res.data.count;
loading.value = false; loading.value = false;
@ -97,7 +97,7 @@ const handleSelect = (key) => {
}; };
const updateShow = (row) => { const updateShow = (row) => {
productStatusApi(userStore.userInfo.service.mer_id, row.product_id, { productStatusApi(userStore.userInfo.service.store_id, row.product_id, {
status: row.is_show ? 1 : 0 status: row.is_show ? 1 : 0
}).then(res=>{ }).then(res=>{
ElMessage.success(res.message); ElMessage.success(res.message);

View File

@ -104,6 +104,7 @@ onUnmounted(() => {
type="month" type="month"
placeholder="请选择月份" placeholder="请选择月份"
@change="changeDate" @change="changeDate"
:clearable="false"
/> />
<el-date-picker <el-date-picker
v-if="listType == 2" v-if="listType == 2"
@ -112,6 +113,7 @@ onUnmounted(() => {
placeholder="请选择日期" placeholder="请选择日期"
@change="changeDate" @change="changeDate"
format="YYYY-MM-DD" format="YYYY-MM-DD"
:clearable="false"
/> />
<el-button type="primary" style="margin-left: 1rem">重置</el-button> <el-button type="primary" style="margin-left: 1rem">重置</el-button>
</div> </div>

View File

@ -9,7 +9,7 @@ export default ({ mode }) => defineConfig({
outDir: loadEnv(mode, process.cwd()).VITE_NOW_TYPE outDir: loadEnv(mode, process.cwd()).VITE_NOW_TYPE
}, },
server: { server: {
port: '5178', port: '5181',
host: '0.0.0.0', host: '0.0.0.0',
}, },
resolve: { resolve: {