diff --git a/App.vue b/App.vue index 8533888..07d19fa 100644 --- a/App.vue +++ b/App.vue @@ -1,45 +1,51 @@ + @import "@/uni_modules/uview-plus/index.scss"; + + page { + font-size: 26rpx; + background-color: #f6f6f6; + } + + .fiexd-btn-box { + position: fixed; + bottom: 0; + left: 0; + height: 120rpx; + height: calc(constant(safe-area-inset-bottom) + 120rpx); + /* 适用于iOS设备 */ + height: calc(env(safe-area-inset-bottom) + 120rpx); + /* 适用于Android设备 */ + width: 100%; + box-sizing: border-box; + background-color: #fff; + padding: 20rpx; + padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx); + /* 适用于iOS设备 */ + padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx); + /* 适用于Android设备 */ + display: flex; + justify-content: space-between; + align-items: center; + } + \ No newline at end of file diff --git a/api/order.js b/api/order.js index e5eefc5..22212b1 100644 --- a/api/order.js +++ b/api/order.js @@ -54,4 +54,9 @@ export const writeOrderApi = (data) => { // 核销数量统计 export const writeCountApi = (data) => { return request.post('/order/order/write_count', data); +} + +// 根据核销码查询记录 +export const writeCodeApi = (data) => { + return request.post('/order/order/write_code', data); } \ No newline at end of file diff --git a/api/user.js b/api/user.js index 7e39b9f..7accac7 100644 --- a/api/user.js +++ b/api/user.js @@ -60,4 +60,37 @@ export const merchantListApi = (data) => { // 充值 export const rechargeApi = (data) => { return request.post('/user/user/recharge', data); +} + +// 商品访问记录 +export const productLogApi = (data) => { + return request.post('/user/UserVisit/productLog', data); +} + +// 用户页面访问记录 +export const htmlLogApi = (data) => { + return request.post('/user/UserVisit/htmlLog', data); +} + + +// 用户页面访问记录 +export const userInfoApi = (data) => { + return request.post('/user/user/info', data); +} + + +// 充值规格 +export const rechargeAmountApi = (data) => { + return request.post('/user/user/rechange_amount', data); +} + +// 会员账户统计 +export const capitalCountAPi = (data) => { + return request.post('/user/user/capital_count', data); +} + + +// 会员账户详情 +export const chargeListApi = (data) => { + return request.post('/user/user/capital_flow', data); } \ No newline at end of file diff --git a/components/goodPopup.vue b/components/goodPopup.vue index 55c428e..ab36636 100644 --- a/components/goodPopup.vue +++ b/components/goodPopup.vue @@ -6,7 +6,7 @@ 商品名称 - {{datas.name || datas.goods_name}} + {{datas.name || datas.goods_name || datas.store_name}} 商品单位 diff --git a/multipleShop/images/time.png b/multipleShop/images/time.png deleted file mode 100644 index 327d875..0000000 Binary files a/multipleShop/images/time.png and /dev/null differ diff --git a/multipleShop/index/index.vue b/multipleShop/index/index.vue index cfea4a8..114ab3f 100644 --- a/multipleShop/index/index.vue +++ b/multipleShop/index/index.vue @@ -48,7 +48,7 @@ - + @@ -122,7 +122,7 @@ status.value == 'loading'; shopListApi(queryParams).then(res => { let len = res.data.lists; - status.value = queryParams.page_size > len ? 'nomore' : 'loadmore'; + status.value = queryParams.page_size > len.length ? 'nomore' : 'loadmore'; shopList.value = shopList.value.concat(res.data.lists); if (status.value == 'loadmore') queryParams.page_no += 1; }) diff --git a/multipleShop/orderVerification/index.vue b/multipleShop/orderVerification/index.vue index bac9b0d..23a8162 100644 --- a/multipleShop/orderVerification/index.vue +++ b/multipleShop/orderVerification/index.vue @@ -7,7 +7,7 @@ 核销券码 - 确认核销 + 确认核销 @@ -21,30 +21,34 @@ - - + + 请确认核销订单 - 订单编号:wxo1709797879549583601 - - - + 订单编号:{{shopDetail.order_id}} + + + + + + + + + {{item.store_name}} + ¥{{item.price}} + + x{{item.cart_num}} + - - - 黄牛牛肉 - ¥10.00 - - x5 - - 共5件商品,总金额 - ¥50.00 - + + + 共{{shopDetail.total_num}}件商品,总金额 + ¥{{shopDetail.total_price}} - 确认核销 + 确认核销 @@ -56,10 +60,11 @@ ref } from "vue"; import { - writeOrderApi + writeOrderApi, + writeCodeApi } from "@/api/order.js"; - const show = ref(false); + const show = ref(true); const writeCode = ref(''); // 确认核销 @@ -68,6 +73,7 @@ writeOrderApi({ verify_code: writeCode.value }).then(res => { + writeCode.value = ''; //清空 if (res.code == 1) { uni.showToast({ title: '核销成功', @@ -90,30 +96,22 @@ }) } - // 切换到核销 + const shopDetail = ref(null); + // 根据核销码获取商品 + const onConfirmProduct = () => { + writeCodeApi({ + code: writeCode.value + }).then(res => { + shopDetail.value = res.data; + }) + } + + // 二维码 const onScanToWrite = () => { uni.scanCode({ success(resp) { - writeOrderApi({ - verify_code: resp.result - }).then(res => { - if (res.code == 1) { - uni.showToast({ - title: '核销成功', - icon: 'none', - success() { - uni.$u.sleep(1500).then(rrr => { - uni.navigateBack(); - }) - } - }) - } else { - uni.showToast({ - title: '核销失败', - icon: 'none' - }) - } - }) + writeCode.value = resp.result; + onConfirmProduct(); } }) } @@ -225,12 +223,12 @@ display: flex; justify-content: space-between; width: 630rpx; - height: 190rpx; + height: 150rpx; background: #F7F7F7; border-radius: 16rpx; - margin-bottom: 36rpx; - padding: 24rpx; + padding: 24rpx 24rpx 0; box-sizing: border-box; + margin-bottom: 20rpx; .popup-goods-left { margin-right: 24rpx; @@ -263,20 +261,20 @@ color: #777777; text-align: right; } + } + } - .popup-goods-total { - text-align: right; + .popup-goods-total { + text-align: right; - .popup-goods-total-num { - font-size: 24rpx; - color: #666666; - } + .popup-goods-total-num { + font-size: 24rpx; + color: #666666; + } - .popup-goods-total-price { - font-size: 24rpx; - color: #F55726; - } - } + .popup-goods-total-price { + font-size: 24rpx; + color: #F55726; } } } diff --git a/multipleShop/verificationOrder/detail.vue b/multipleShop/verificationOrder/detail.vue index 9381bbe..5828e21 100644 --- a/multipleShop/verificationOrder/detail.vue +++ b/multipleShop/verificationOrder/detail.vue @@ -26,9 +26,9 @@ 共计{{shopInfo.total_num || 0}}件 - - - 扫码核销 + + + 扫码核销 @@ -158,7 +158,6 @@ .popup-goods-total { text-align: right; - margin-bottom: 50rpx; .popup-goods-total-num { font-size: 24rpx; @@ -175,8 +174,14 @@ height: 90rpx; background: #20B128; border-radius: 20rpx; + margin-top: 50rpx; - &>view { + .btn-img { + width: 76rpx; + height: 76rpx; + } + + .btn-txt { font-size: 32rpx; color: #FFFFFF; margin-left: 8rpx; diff --git a/multipleShop/verificationOrder/index.vue b/multipleShop/verificationOrder/index.vue index c1e6e91..0166912 100644 --- a/multipleShop/verificationOrder/index.vue +++ b/multipleShop/verificationOrder/index.vue @@ -27,7 +27,8 @@ - + + @@ -37,7 +38,7 @@ 订单编号:{{item.order_id}} - + @@ -55,10 +56,9 @@ - - - 扫码核销 + + 扫码核销 @@ -135,9 +135,6 @@ }) } }) - // uni.navigateTo({ - // url: "/multipleShop/verification/detail?id=" + item.id - // }) } // 输入核销码核销 @@ -200,6 +197,9 @@ onSearch(); getList(); + + // 隐藏home键返回主页 + uni.hideHomeButton(); }) @@ -270,6 +270,11 @@ justify-content: center; align-items: center; margin-right: 38rpx; + + image { + width: 76rpx; + height: 76rpx; + } } .order-list-item-trans-right { @@ -315,7 +320,12 @@ background: #20B128; border-radius: 20rpx; - &>view { + .btn-img { + width: 60rpx; + height: 60rpx; + } + + .btn-txt { font-size: 32rpx; color: #FFFFFF; margin-left: 8rpx; @@ -323,8 +333,6 @@ } } - - .order-tab { display: flex; align-items: center; diff --git a/pages.json b/pages.json index c732cdd..1852cde 100644 --- a/pages.json +++ b/pages.json @@ -9,13 +9,7 @@ } }, "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/member/member", - "style": { - "navigationBarTitleText": "会员充值", - "enablePullDownRefresh": false, - } - }, + { "path": "pages/index/index", "style": { @@ -55,37 +49,52 @@ "enablePullDownRefresh": false, "navigationStyle": "custom" } + }, + { + "path": "pages/charge/charge_record", + "style": { + "navigationBarTitleText": "充值记录", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/charge/charge", + "style": { + "navigationBarTitleText": "会员充值", + "enablePullDownRefresh": false + } } ], "subPackages": [{ "root": "multipleShop", "pages": [{ - "path": "index/index", - "style": { - "navigationBarTitleText": "选择门店", - "enablePullDownRefresh": false + "path": "index/index", + "style": { + "navigationBarTitleText": "选择门店", + "enablePullDownRefresh": false + } + }, + { + "path": "verificationOrder/index", + "style": { + "navigationBarTitleText": "核销订单", + "enablePullDownRefresh": false, + "disableScroll": true + } + }, { + "path": "verificationOrder/detail", + "style": { + "navigationBarTitleText": "核销订单详情", + "enablePullDownRefresh": false + } + }, { + "path": "orderVerification/index", + "style": { + "navigationBarTitleText": "订单核销", + "enablePullDownRefresh": false + } } - - }, { - "path": "verificationOrder/index", - "style": { - "navigationBarTitleText": "核销订单", - "enablePullDownRefresh": false, - "disableScroll": true - } - }, { - "path": "verificationOrder/detail", - "style": { - "navigationBarTitleText": "核销订单详情", - "enablePullDownRefresh": false - } - }, { - "path": "orderVerification/index", - "style": { - "navigationBarTitleText": "订单核销", - "enablePullDownRefresh": false - } - }] + ] }, { "root": "pagesOrder", "pages": [{ diff --git a/pages/charge/charge.vue b/pages/charge/charge.vue index da9c892..c8c6114 100644 --- a/pages/charge/charge.vue +++ b/pages/charge/charge.vue @@ -1,12 +1,179 @@ + + + - \ No newline at end of file + \ No newline at end of file diff --git a/pages/charge/charge_record.vue b/pages/charge/charge_record.vue new file mode 100644 index 0000000..7c5a005 --- /dev/null +++ b/pages/charge/charge_record.vue @@ -0,0 +1,286 @@ + + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 279ab0a..61fbff2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -170,7 +170,11 @@ cartCreateApi, cartChangeApi, cartListApi - } from "@/api/cart.js" + } from "@/api/cart.js"; + import { + productLogApi, + userInfoApi + } from "@/api/user.js"; import viewPopup from "@/components/viewPopup.vue" import goodPopup from "@/components/goodPopup.vue" import useCartStore from "@/store/cart.js" @@ -187,7 +191,6 @@ }) } - /*商品列表滚动隐藏头部导航 */ const instance = getCurrentInstance(); // 获取组件实例 const targetHeight = ref(0) @@ -241,7 +244,6 @@ }).then(res => { getCartList(); }).catch(err => { - console.log(err); uni.$u.toast('添加失败') }) } @@ -301,7 +303,7 @@ const classMap = new Map(); const getgoodClassList = (pid = 0, three = 0) => { let page_no = classMap.get(pid) || 1; - console.log(classMap.get(pid)); + // console.log(classMap.get(pid)); goodClassListApi({ pid: pid, page_no: page_no, @@ -381,8 +383,7 @@ } const navTo = (url) => { - // if (!userStore.token || !userStore.userInfo.mobile) return uni.showModal({ - if (!userStore.token) return uni.showModal({ + if (!userStore.token || !userStore.userInfo.mobile) return uni.showModal({ content: '您需要先登录才可使用该功能, 是否前去登录', success: (e) => { if (e.confirm) { @@ -410,6 +411,13 @@ goodData.value = item; goodRef.value.setData(item); showGoodPopup.value = true; + + //统计商品的访问记录 + productLogApi({ + product_id: item.product_id, + cate_id: item.cate_id + }); + }; const changeGood = (data) => { // 确定选择商品重量 showGoodPopup.value = false; @@ -429,8 +437,6 @@ } }); - - console.log(data); addCart(data.id, data.cart_num); } // 结算 @@ -465,8 +471,21 @@ }) onShow(() => { - getCartList(); - }) + // 如果后台变更核销人员权限 可以及时切换 + if (userStore.token && userStore.userInfo.mobile) { + userInfoApi().then(res => { + const user = res.data; + userStore.setUserInfo(user); + if (user.is_staff == 1) { + uni.reLaunch({ + url: "/multipleShop/verificationOrder/index" + }) + } else { + getCartList(); + } + }); + } + }); onMounted(() => { const instance = getCurrentInstance(); // 获取组件实例 @@ -486,7 +505,6 @@ setTimeout(() => { getWXDom() }, 500) - }) diff --git a/pages/login/login.vue b/pages/login/login.vue index 4b0f061..16cc5f7 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -149,12 +149,25 @@ userStore.setToken(res.data.token); if (!res.data.mobile) { //未绑定手机号 - tempUser.value = res.data; + // tempUser.value = res.data; return showBind.value = true; } else { userStore.setUserInfo(res.data); + //再次登录 已有手机号 判断是否员工 + + //身份授权成功 核销人员 + if (res.data.is_staff == 1) { + userStore.setUserInfo(res.data); + uni.reLaunch({ + url: "/multipleShop/verificationOrder/index" + }) + } else { // 直接选择门店 + uni.reLaunch({ + url: "/multipleShop/index/index" + }) + } } - navToIndex(); + // navToIndex(); }) }, fail: (err) => { @@ -173,7 +186,6 @@ }).then(res => { //手机号获取成功 可以本地缓存用户信息以及token userStore.setUserInfo(res.data); - //身份授权成功 核销人员 if (res.is_staff == 1) { userStore.setUserInfo(res.data); diff --git a/pages/member/member.vue b/pages/member/member.vue index e566f52..6cef0ac 100644 --- a/pages/member/member.vue +++ b/pages/member/member.vue @@ -1,359 +1,319 @@ - - - - - - - \ No newline at end of file + rechargeApi({ + price: 0.01 + }).then(res => { + + + if (!res.data?.nonceStr) return uni.$u.toast('支付失败!'); + console.log(2); + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.package, + signType: res.data.signType, + paySign: res.data.paySign, + success: (e) => { + if (e.errMsg == 'requestPayment:ok') { + uni.showModal({ + title: '订单支付成功', + confirmText: '查看订单', + cancelText: '继续购买', + success: (e) => { + if (e.confirm) uni.redirectTo({ + url: '/pagesOrder/order/order?back=-1&type=2' + }) + else uni.navigateBack(); + } + }) + } else uni.$u.toast('支付失败') + }, + fail: (e) => { + uni.$u.toast('用户取消支付'); + uni.redirectTo({ + url: '/pagesOrder/order/order?back=-1&type=1' + }) + } + }) + }) + + + \ No newline at end of file diff --git a/pages/my/my.vue b/pages/my/my.vue index 94ac1f5..928be91 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -16,15 +16,15 @@ - 123 + {{userInfo.vip_name}} 会员等级 - 123 + {{userInfo.discount}} 可享折扣 - 123 + {{userInfo.now_money}} 可用余额 @@ -37,18 +37,22 @@ 初级会员 - 活动期间下单即享初级会员 + + {{userInfo.user_ship>0?'享折扣权益':'活动期间下单即享初级会员'}} + + + + {{userInfo.user_ship>0?'立即升级':'立即下单'}} - 立即下单 - 当前已充值1000,升级还需2000 - Lv.2 + 当前已充值{{userInfo.total_recharge_amount}},升级还需{{userInfo.next_limit}} + {{userInfo.next_level}} - + @@ -130,6 +134,19 @@ }) } + // 返回下单 或者充值 + const handleBack = (e) => { + console.log(userInfo.user_ship); + + if (e > 0) { + uni.navigateTo({ + url: "/pages/charge/charge" + }) + } else { + uni.navigateBack() + } + } + const navTo = (type = 0) => { uni.navigateTo({ url: `/pagesOrder/order/order?type=${type}` diff --git a/static/icon/account_bg.webp b/static/icon/account_bg.webp new file mode 100644 index 0000000..cc7ea41 Binary files /dev/null and b/static/icon/account_bg.webp differ diff --git a/static/icon/charge_bg.webp b/static/icon/charge_bg.webp new file mode 100644 index 0000000..50c20a6 Binary files /dev/null and b/static/icon/charge_bg.webp differ diff --git a/static/icon/diamond.webp b/static/icon/diamond.webp new file mode 100644 index 0000000..ebab5c8 Binary files /dev/null and b/static/icon/diamond.webp differ diff --git a/static/icon/order.webp b/static/icon/order.webp new file mode 100644 index 0000000..66e6e35 Binary files /dev/null and b/static/icon/order.webp differ