diff --git a/common/api/account/config.js b/common/api/account/config.js new file mode 100644 index 0000000..a75bf78 --- /dev/null +++ b/common/api/account/config.js @@ -0,0 +1 @@ +export const prveUrl='/account' \ No newline at end of file diff --git a/common/api/account/points.js b/common/api/account/points.js new file mode 100644 index 0000000..7532d25 --- /dev/null +++ b/common/api/account/points.js @@ -0,0 +1,13 @@ +// 引入 request 文件 +import request from '@/common/api/request.js' +import {prveUrl} from './config.js' + +export const pointsShopList = (data) => { + return request({ + url: prveUrl + '/user/shopUser/pointsShopList', + method: 'get', + data: data + }) +} + + diff --git a/common/api/market/recharge.js b/common/api/market/recharge.js index 08f5e62..d033637 100644 --- a/common/api/market/recharge.js +++ b/common/api/market/recharge.js @@ -3,10 +3,17 @@ import request from '@/common/api/request.js' import {prveUrl} from './config.js' export const config = (data) => { - const shopId=uni.getStorageSync('shopId')||''; return request({ url: prveUrl + '/user/recharge/config', method: 'get', - data: {...data,shopId:shopId} + data: data + }) +} + +export const list = (data) => { + return request({ + url: prveUrl + '/user/recharge/list', + method: 'get', + data: data }) } diff --git a/common/api/order/index.js b/common/api/order/index.js index cfabfea..943609c 100644 --- a/common/api/order/index.js +++ b/common/api/order/index.js @@ -1,6 +1,18 @@ // 引入 request 文件 import request from '@/common/api/request.js' const url = '/order' + +let platformType = ''; +let payType=''; +// #ifdef MP-WEIXIN +platformType = 'wechat' +payType='wechatPay' +// #endif +// #ifdef MP-ALIPAY +platformType = 'alipay' +payType='aliPay' +// #endif + //订单列表 export const APIuserorder = (data) => { return request({ @@ -70,4 +82,30 @@ export const joinMember = (data) => { method: 'post', data: data }) +} +//会员购买支付 +export const ltPayMember = (data) => { + return request({ + url: url + '/pay/ltPayMember', + method: 'post', + data: { + platformType, + payType, + openId: uni.cache.get('miniAppOpenId'), + ...data + } + }) +} +//智慧充值 +export const recharge = (data) => { + return request({ + url: url + '/pay/recharge', + method: 'post', + data: { + platformType, + payType, + openId: uni.cache.get('miniAppOpenId'), + ...data + } + }) } \ No newline at end of file diff --git a/pages.json b/pages.json index 56f0b82..ebfb626 100644 --- a/pages.json +++ b/pages.json @@ -103,6 +103,12 @@ "navigationBarTitleText": "会员列表" } }, + { + "path": "pages/user/member/amount-list", + "style": { + "navigationBarTitleText": "储值列表" + } + }, { "path": "pages/user/member/memberdetails", "style": { @@ -216,6 +222,13 @@ "navigationBarTitleText" : "", "navigationStyle": "custom" } + }, + { + "path" : "score/list", + "style" : + { + "navigationBarTitleText" : "积分门店" + } } ] diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index 00cb5c6..2f4bded 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -10,8 +10,9 @@ 在线点不排队 - + + @@ -19,7 +20,11 @@ 入会享权益 - + + + @@ -65,6 +70,27 @@ type: 'index', }) } + + function tomember() { + const shopUserInfo = uni.cache.get('shopUserInfo')||{} + const shopId = uni.cache.get('shopId') + if(!shopUserInfo.isVip){ + uni.navigateTo({ + url: '/user/vip/buy-vip?shopId=' + shopId + }) + return + } + uni.navigateTo({ + url: '/user/vip/vip?shopId=' + shopId + }) + } + + function toCharge() { + const shopId = uni.cache.get('shopId') + uni.navigateTo({ + url: '/pages/user/member/czzx?shopId='+shopId + }) + } const getQueryString = (url, name) => { //解码 var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i') var r = url.substr(1).match(reg) diff --git a/pages/order/components/IntegralInput.vue b/pages/order/components/IntegralInput.vue index a42b411..8e2382e 100644 --- a/pages/order/components/IntegralInput.vue +++ b/pages/order/components/IntegralInput.vue @@ -115,7 +115,7 @@ left: 0; width: 100%; height: 100%; - z-index: 999; + z-index: 9999; } .modal-mask { diff --git a/pages/order/confirm-order.vue b/pages/order/confirm-order.vue index 02960fb..a1a7792 100644 --- a/pages/order/confirm-order.vue +++ b/pages/order/confirm-order.vue @@ -852,6 +852,8 @@ } catch (error) { //TODO handle the exception } + + orderorderInfo() }); let options = {} diff --git a/pages/user/member/amount-list.vue b/pages/user/member/amount-list.vue new file mode 100644 index 0000000..fb95927 --- /dev/null +++ b/pages/user/member/amount-list.vue @@ -0,0 +1,171 @@ + + + + + \ No newline at end of file diff --git a/pages/user/member/billDetails - 副本.vue b/pages/user/member/billDetails - 副本.vue new file mode 100644 index 0000000..5cacd58 --- /dev/null +++ b/pages/user/member/billDetails - 副本.vue @@ -0,0 +1,306 @@ + + + + + \ No newline at end of file diff --git a/pages/user/member/billDetails.vue b/pages/user/member/billDetails.vue index 5cacd58..0e506a7 100644 --- a/pages/user/member/billDetails.vue +++ b/pages/user/member/billDetails.vue @@ -5,11 +5,11 @@ 我的余额 - {{formData.info.amount||0}} + {{shopUserInfo.amount||0}} 我的积分 - {{formData.info.accountPoints||0}} + {{shopUserInfo.accountPoints||0}} @@ -92,16 +92,19 @@ reactive, onMounted } from 'vue' - + import { - onReachBottom + onReachBottom,onLoad } from '@dcloudio/uni-app' import { APIshopUsermoneyRecord, APIshopUserpointsRecord } from '@/common/api/member.js' - + import { + APIusershopInfodetail, + APIshopUserInfo + } from '@/common/api/member.js' function back(){ uni.navigateBack() @@ -181,20 +184,27 @@ onReachBottom(() => { getlist() }) - - onMounted(() => { - // 获取当前页面栈 - const pages = getCurrentPages(); - // 获取当前页面实例 - const currentPage = pages[pages.length - 1]; - // 获取页面参数 - const options = currentPage.options; - formData.info = JSON.parse(decodeURIComponent(options.shopInfo)) + + const shopUserInfo=reactive({}) + async function getShopUserInfo(){ + const res=await APIshopUserInfo({ + shopId: options.shopId + }) + if(res){ + Object.assign(shopUserInfo,res) + } + } + const options=reactive({}) + onLoad((opt)=>{ + Object.assign(options,opt) + console.log('options',options); formData.shopId = options.shopId formData.active = options.type console.log(formData.info) getlist() + getShopUserInfo() }) + \ No newline at end of file diff --git a/pages/user/member/list.vue b/pages/user/member/list.vue index e2cf873..7c6ab1d 100644 --- a/pages/user/member/list.vue +++ b/pages/user/member/list.vue @@ -14,16 +14,16 @@ - 余额:{{item.amount}} + + {{item.shopName}} - + - @@ -41,6 +41,8 @@ import { APIusershopUservipCard } from '@/common/api/member.js' + import * as vipApi from '@/common/api/market/vip.js' + const orderForm = reactive({ type: '', //类型 @@ -55,58 +57,21 @@ const paygetShopByMember = async () => { - let res = await APIusershopUservipCard({ + let res = await vipApi.list({ page: orderForm.form.page, pageSize: orderForm.form.size, }) - - if (res.totalPage == 1 && res.totalRow <= 10) { - orderForm.form.status = 'nomore' - orderForm.list = res.records - if (orderForm.form.page == 1 && res.records.length == 0) { - orderForm.records = [] - orderForm.is_end = true - } - return false; - } else { - orderForm.form.status = 'loading'; - orderForm.list = [...orderForm.list, ...res.records]; - orderForm.form.page = ++orderForm.form.page; - if (orderForm.form.page > res.totalPage) { - orderForm.form.status = 'nomore'; - } else { - orderForm.form.status = 'loading'; - } - } + orderForm.list = res; + } const eeInfo = async (item) => { - // if (res.code == 0) { - // uni.cache.set('shopUserInfo', res) - // uni.cache.set('shopId', item.shopId) - if (orderForm.type && orderForm.type == 'user_payCode') { - uni.navigateTo({ - url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(item) - }) - } else if (orderForm.type && orderForm.type == 'user_recharge') { - uni.pro.navigateTo('member/index', { - shopId: item.shopId, - type: 'index', - }) - } else if (orderForm.type && orderForm.type == 'user_points') { - uni.pro.navigateTo('/pagesPoints/index/index', { - shopId: item.shopId, - type: 'member_list', - }) - } else { - uni.pro.navigateTo('user/member/memberdetails', { - shopId: item.shopId - }) - - } + uni.navigateTo({ + url:'/user/vip/vip?shopId='+item.shopId + }) } onReachBottom(() => { - paygetShopByMember() + // paygetShopByMember() }) onMounted((e) => { paygetShopByMember() diff --git a/pages/user/member/setPassword.vue b/pages/user/member/setPassword.vue index 68f34f8..2887358 100644 --- a/pages/user/member/setPassword.vue +++ b/pages/user/member/setPassword.vue @@ -8,15 +8,18 @@ 获取手机号 --> + + + 密码支付 + 关闭时,使用余额支付将会直接扣除,不再进行确认 + + + + 密码支付 当前账号 - - - - - - + {{ datalist.Recapture }} @@ -25,6 +28,12 @@ + + + + + 新密码 { - // 获取当前页面栈 - const pages = getCurrentPages(); - // 获取当前页面实例 - const currentPage = pages[pages.length - 1]; - // 获取页面参数 - const options = currentPage.options; - // if (options.shopId) { - // let res = await APIshopUserInfo({F - // shopId: options.shopId - // }) - // uni.cache.set('shopId', options.shopId, 30) - // uni.cache.set('orderVIP', res) - // uni.cache.set('ordershopUserInfo', res.shopInfo) - // } else { - // shopUserInfo.shopInfo = JSON.parse(decodeURIComponent(options.shopInfo)) - // } - }) - \ No newline at end of file diff --git a/pages/user/user.vue b/pages/user/user.vue index 82ad439..3cdc530 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -22,7 +22,7 @@ - + 我的资产 @@ -33,25 +33,27 @@ 储值 - - 3家店 + + {{rechargeList.length}}家店 - - + + ¥ - 9999.99 + {{item.amount}} - 这里是店铺名称 + {{item.shopName}} - + 查看全部 @@ -63,25 +65,22 @@ 会员 - - 3家店 + + {{memberList.length}}家店 - - + + - - ¥ - 9999.99 - - 这里是店铺名称 + {{item.shopName}} - + 查看全部 @@ -129,11 +128,15 @@ productStore } from '@/stores/user.js'; import * as vipApi from '@/common/api/market/vip.js' + import * as rechargeApi from '@/common/api/market/recharge.js' + + const store = productStore(); const myFunList = ref([{ name: "积分", type: "score", - icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" + icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png", + url: '/user/score/list' }, { name: "优惠券", @@ -162,26 +165,32 @@ const userInfo = reactive({}) const ShopId = ref(uni.cache.get('shopId')) - - - function tomemberList(){ + console.log('ShopId', uni.cache.get('shopId')) + + function tomemberList() { uni.navigateTo({ - url:'/pages/user/member/list' + url: '/pages/user/member/list' + }) + } + + function tomember(item) { + uni.navigateTo({ + url: '/user/vip/vip?shopId=' + item.shopId }) } const clickEvent = () => { if (ShopId.value) { - if(!userInfo.isVip){ + if (!userInfo.isVip) { uni.navigateTo({ - url: '/user/vip/buy-vip?shopId='+ShopId.value + url: '/user/vip/buy-vip?shopId=' + ShopId.value }) - }else{ + } else { uni.navigateTo({ - url: '/user/vip/vip?shopId='+ShopId.value + url: '/user/vip/vip?shopId=' + ShopId.value }) } - + // if (userInfo.isVip == 0) { @@ -216,7 +225,26 @@ } } + function toCharge(item) { + uni.navigateTo({ + url: '/pages/user/member/czzx?shopId=' + item.shopId + }) + } + + function toChargeList() { + uni.navigateTo({ + url: '/pages/user/member/amount-list' + }) + } + + const clickTo = (item, index) => { + if (item.url) { + uni.navigateTo({ + url:item.url + }) + return + } let shopId = null; switch (item.type) { case 'my_order': @@ -267,9 +295,14 @@ break; } } + + const memberList = ref([]) + const rechargeList = ref([]) async function getData() { const res = await vipApi.list() - console.log(res); + memberList.value = res.slice(0, 3); + const res1 = await rechargeApi.list() + rechargeList.value = res1.slice(0, 3); } onShow(() => { store.actionsAPIuser() @@ -450,9 +483,11 @@ .card-list-item { max-width: 182rpx; box-shadow: 8rpx 8rpx 32rpx 0 #0b18390f; + border-radius: 0 0 20rpx 20rpx; .info { padding-bottom: 16rpx; + border-radius: 0 0 20rpx 20rpx; overflow: hidden; } } diff --git a/user/score/list.vue b/user/score/list.vue new file mode 100644 index 0000000..ef35a2d --- /dev/null +++ b/user/score/list.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/user/vip/buy-vip.vue b/user/vip/buy-vip.vue index 89201ab..2afabc1 100644 --- a/user/vip/buy-vip.vue +++ b/user/vip/buy-vip.vue @@ -146,11 +146,13 @@ computed } from "vue" import { - joinMember + joinMember, + ltPayMember } from '@/common/api/order/index.js' import * as vipApi from '@/common/api/market/vip.js' + import {pay} from '@/utils/pay.js' import { - APIusershopInfodetail + APIusershopInfodetail,APIshopUserInfo } from '@/common/api/member.js' import { onLoad @@ -162,8 +164,8 @@ show1: false, title: '' }) - - const memberOpen=ref(false) + + const memberOpen = ref(false) function modelHide() { model.show = false; @@ -278,7 +280,14 @@ } const memberLevel = ref(null) const shopInfo = reactive({}) + const shopUserInfo = ref({}) async function init(shopId) { + const userRes= await APIshopUserInfo({ + shopId + }) + if (userRes) { + shopUserInfo.value=userRes + } const shopRes = await APIusershopInfodetail({ shopId }) @@ -289,8 +298,10 @@ shopId: shopId }) if (res) { - if(res.memberConfig.isSubmitInfo){ - memberOpen.value=true; + if (res.memberConfig.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex === + undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value + .phone)) { + memberOpen.value = true; } conditionList.value = res.memberConfig.conditionList.map(v => { const json = { @@ -335,33 +346,49 @@ onLoad((opt) => { Object.assign(option, opt) console.log(option); - let shopId = uni.cache.get('shopId') - if (opt.shopId) { - shopId = opt.shopId - } - if (shopId) { - option.shopId = shopId - } + let shopId = option.shopId init(shopId) }) - - let userInfo = {} - function emitsmemberOpen(e){ - memberOpen.value=false - userInfo=e + + + function emitsmemberOpen(e) { + memberOpen.value = false + Object.assign(shopUserInfo.value,e) } async function buy() { const json = { shopId: option.shopId, name: configList.value[vipSel.value].name, num: 1, + shopId: option.shopId, + shopUserId: shopUserInfo.value.id } if (state.isSubmitInfo) { - json.sex = userInfo.sex ; - json.birthDay = userInfo.birthDay; - json.nickName = userInfo.nickName + json.sex = shopUserInfo.value.sex; + json.birthDay = shopUserInfo.value.birthDay; + json.nickName = shopUserInfo.value.nickName + } + + const res = await ltPayMember(json) + if (!res) { + return uni.showToast({ + title: '购买失败', + icon:'error' + }) + } + const payRes=await pay(res) + console.log(payRes); + if(payRes){ + uni.showToast({ + title: '开通会员成功', + icon:'none' + }) + setTimeout(()=>{ + uni.redirectTo({ + url:'/user/vip/vip?shopId='+option.shopId + }) + },1000) } - const res = await joinMember(json) } diff --git a/user/vip/vip.vue b/user/vip/vip.vue index 8810e2c..a612812 100644 --- a/user/vip/vip.vue +++ b/user/vip/vip.vue @@ -7,23 +7,27 @@ 当前等级 - 店铺名称 - 白银会员 - - 2025.10.14到期 - 月度会员 + + {{shopInfo.shopName}} + {{memberLevel?memberLevel.name:''}} + + {{memberLevel?memberLevel.endTime:''}}到期 + 月度会员 + + + + {{memberLevel? memberLevel.experience:''}} + 经验值 + + 等级说明 + + + + + + 还差{{memberLevel?memberLevel.nextExperienceValue:''}}成长值可以升级到{{nextName}} - - - 11000 - 经验值 - - 等级说明 - - - - - 还差5695成长值可以升级到黄金会员 + @@ -31,18 +35,19 @@ 会员权益 会员说明 - + - + - + {{item.name}} - + {{item.desc}} @@ -53,19 +58,19 @@ 升级规则 - 每消费1元获得10成长值 + 每消费1元获得{{state.costReward||''}}成长值 - 每消费1元获得10成长值 + 每消费1元获得{{state.rechargeReward||''}}成长值 - + - 详情说明 + {{model.title}} @@ -78,36 +83,52 @@ @@ -203,7 +325,7 @@ } .vip-box { - + background-size: cover; position: relative; border-radius: 12px; diff --git a/utils/pay.js b/utils/pay.js new file mode 100644 index 0000000..b4aec2c --- /dev/null +++ b/utils/pay.js @@ -0,0 +1,57 @@ +export const pay = (res) => { + return new Promise((reslove, reject) => { + uni.showLoading({ + title: '支付中...', + mask: true + }) + uni.requestPayment({ + // #ifdef MP-WEIXIN + provider: 'wxpay', //支付类型-固定值 + partnerid: res.appId, // 微信支付商户号 + timeStamp: res.timeStamp, // 时间戳(单位:秒) + nonceStr: res.nonceStr, // 随机字符串 + package: res.package, // 固定值 + signType: res.signType, //固定值 + paySign: res.paySign, //签名 + // #endif + // #ifdef MP-ALIPAY + provider: 'alipay', //支付类型-固定值 + orderInfo: res.tradeNo, // 微信支付商户号 + // #endif + success: (res) => { + console.log('pay'); + console.log(res); + uni.hideLoading() + // #ifdef MP-WEIXIN + uni.showToast({ + title: "支付成功", + icon:'none' + }) + console.log('支付成功') + resolve(res) + // #endif + // #ifdef MP-ALIPAY + if (res.resultCode == '9000') { + uni.showToast({ + title: "支付成功", + icon:'none' + }) + resolve(res) + } else { + uni.showToast({ + title: "支付失败", + icon:'none' + }) + } + // #endif + }, + fail: (res) => { + setTimeout(() => { + uni.hideLoading() + }, 1000) + reject(false) + }, + + }); + }) +} \ No newline at end of file