Browse Source

新增小程序储值

master
ywh 1 year ago
parent
commit
764a23e62e
15 changed files with 201 additions and 64 deletions
  1. +3
    -2
      src/api/order.js
  2. +2
    -2
      src/components/GoodsList/GoodsList.vue
  3. +5
    -3
      src/manifest.json
  4. +16
    -7
      src/pages.json
  5. +2
    -2
      src/pages/applicableStore/applicableStore.vue
  6. +2
    -2
      src/pages/food/food.vue
  7. +2
    -7
      src/pages/login/login.vue
  8. +4
    -3
      src/pages/my/my.vue
  9. +22
    -5
      src/pages/payment/payment.vue
  10. +8
    -5
      src/pages/storedValueAccount/storedValueAccount.vue
  11. +26
    -9
      src/pages/storedValueActivity/storedValueActivity.vue
  12. +92
    -0
      src/pages/storedValueAgreement/storedValueAgreement.vue
  13. +3
    -2
      src/pages/storedValueRecord/storedValueRecord.vue
  14. +4
    -4
      src/pages/welcome/welcome.vue
  15. +10
    -11
      src/utils/request.js

+ 3
- 2
src/api/order.js View File

@@ -29,12 +29,13 @@ export default {
});
},
//订单付款
orderPay(orderNumber, reason = '用户主动点击付款') {
orderPay(orderNumber, reason = '用户主动点击付款', payWay = 0) {
return request({
url: '/order/v2/orderpay',
data: {
orderNumber,
reason
reason,
payWay
},
interfaceType: 1,
method: 'POST'


+ 2
- 2
src/components/GoodsList/GoodsList.vue View File

@@ -31,7 +31,7 @@
{{food.name}}
</view>
<view class="food-card-no-vip">
非会员{{food.price}}
非会员{{food.price}}
</view>
<view class="food-card-price">
<view class="card-price-left">
@@ -39,7 +39,7 @@
<image :lazy-load="true" class="image-common-cover" :src="imageServer.concat('ca8ae689-92cf-427a-b34f-b64b81368ae8.png')"></image>
</view>
<view class="minimum-price green-color">
¥{{food.vipPrice}}
¥{{food.vipPrice}}
</view>
</view>
<view class="card-price-right" v-if="!isSpecialOffer">


+ 5
- 3
src/manifest.json View File

@@ -54,16 +54,18 @@
"quickapp" : {},
/* 快应用特有相关 */
"mp-weixin" : {
"appid" : "",
"appid" : "wx67f7399628986bfb",
"setting" : {
"urlCheck" : false
"urlCheck" : false,
"minified" : true
},
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "获取门店到用户的距离"
}
}
},
"requiredPrivateInfos": ["getLocation"]
},
"mp-alipay" : {
"usingComponents" : true


+ 16
- 7
src/pages.json View File

@@ -414,6 +414,15 @@
}
}
,{
"path" : "pages/storedValueAgreement/storedValueAgreement",
"style" :
{
"navigationBarTitleText": "储值协议",
"enablePullDownRefresh": false
}
}
],
"tabBar": {
"color": "#999999",
@@ -421,18 +430,18 @@
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/homeBeefWorkShop/homeBeefWorkShop",
"iconPath": "static/images/home.png",
"selectedIconPath": "static/images/home-active.png",
"text": "首页"
},
// {
// "pagePath": "pages/homeNew/homeNew",
// "pagePath": "pages/homeBeefWorkShop/homeBeefWorkShop",
// "iconPath": "static/images/home.png",
// "selectedIconPath": "static/images/home-active.png",
// "text": "首页"
// },
{
"pagePath": "pages/homeNew/homeNew",
"iconPath": "static/images/home.png",
"selectedIconPath": "static/images/home-active.png",
"text": "首页"
},
{
"pagePath": "pages/food/food",
"iconPath": "static/images/food.png",


+ 2
- 2
src/pages/applicableStore/applicableStore.vue View File

@@ -85,8 +85,8 @@
}, 1000);
},
async onSearchUserLocation() {
// let response = await getApp().onGetUserLocation();
if (true) {
let response = await getApp().onGetUserLocation();
if (response) {
this.isShowLoactionAuth = false;
this.onFetchStoreList();
} else {


+ 2
- 2
src/pages/food/food.vue View File

@@ -157,8 +157,8 @@
});
},
async onGetUserLocation() {
// const response = await getApp().onGetUserLocation();
if (true) {
const response = await getApp().onGetUserLocation();
if (response) {
this.isShowLoactionAuth = false;
this.onQueryStoreAndGoods();
} else {


+ 2
- 7
src/pages/login/login.vue View File

@@ -68,15 +68,10 @@
});
} else {
uni.showToast({
title: response.msg,
title: response.errors || "登录失败",
duration: 2000,
icon: 'none',
mask: true,
complete: () => {
setTimeout(() => {
this.onBackPage();
}, 1000);
}
mask: true
});
}
},


+ 4
- 3
src/pages/my/my.vue View File

@@ -148,6 +148,7 @@
},
onShow() {
const userStorage = getApp().onGetUserStorage();
if (!userStorage?.openId) return;
memberAPI.selectMemberByOpenId(userStorage.openId).then(response => {
if (response.isSuccess) {
if (response.data.nickName && getApp().isBase64(response.data.nickName)) {
@@ -191,7 +192,7 @@
});
}, 2000, true),
onMemberInfo: debounce(function() {
getApp().onCheckUserSession('memberCardDetail').then(async response => {
getApp().onCheckUserSession('my').then(async response => {
const userStorage = getApp().onGetUserStorage();
const memberRes = await memberAPI.selectMemberByOpenId(userStorage.openId);
if (memberRes.isSuccess) {
@@ -221,7 +222,7 @@
});
}, 2000, true),
onJumpCoupon: debounce(function() {
getApp().onCheckUserSession('coupon').then(async response => {
getApp().onCheckUserSession('my').then(async response => {
const userStorage = getApp().onGetUserStorage();
const memberRes = await memberAPI.selectMemberByOpenId(userStorage.openId);
if (memberRes.isSuccess) {
@@ -251,7 +252,7 @@
});
}, 2000, true),
onStoredValue: debounce(function() {
getApp().onCheckUserSession('storedValueAccount').then(async response => {
getApp().onCheckUserSession('my').then(async response => {
const userStorage = getApp().onGetUserStorage();
if (userStorage.memberInfo_Id && userStorage.phone) {
uni.navigateTo({


+ 22
- 5
src/pages/payment/payment.vue View File

@@ -156,6 +156,7 @@
}
},
onConfirmPayment: debounce(async function() {
const userStorage = getApp().onGetUserStorage();
if (this.isFinished == true) {
uni.showToast({
title: '支付超时,请返回上一页',
@@ -165,7 +166,6 @@
});
} else {
if (this.paymentMethod === 1) {
const userStorage = getApp().onGetUserStorage();
if (userStorage != null) {
let response = await payAPI.wechatPay(userStorage.openId, this.orderNumber);
let result = response.data;
@@ -207,6 +207,22 @@
});
}
} else {
if (!userStorage.phone) {
uni.showToast({
title: '请注册会员!',
icon: 'none',
duration: 2000
});
return;
}
if (this.totalPrice > this.userWallet?.money) {
uni.showToast({
title: '余额不足',
icon: 'none',
duration: 2000
});
return;
}
const response = await storedValueAPI.walletrecordhandle({
"walletId": this.userWallet.id,
"money": this.totalPrice,
@@ -214,10 +230,11 @@
"transactionMoney": 0,
"giveMoney": 0,
"storeId": this.currentStore.id,
"storeName": this.currentStore.store_Name
"storeName": this.currentStore.store_Name,
"orderId": this.orderNumber
});
if (response.statusCode === 200 && response.data) {
this.handlePaySuccess();
this.handlePaySuccess(2);
} else {
uni.redirectTo({
url: `/pages/paymentStatus/paymentStatus?isSuccess=false`
@@ -229,8 +246,8 @@
/**
* 支付成功后 调用
*/
async handlePaySuccess() {
let orderPayResponse = await orderAPI.orderPay(this.orderNumber);
async handlePaySuccess(payWay = 0) {
let orderPayResponse = await orderAPI.orderPay(this.orderNumber, "用户主动点击付款", payWay);
if (orderPayResponse.isSuccess == true) {
store.commit('onSetCurrentNewOrder', null);
uni.showToast({


+ 8
- 5
src/pages/storedValueAccount/storedValueAccount.vue View File

@@ -154,11 +154,14 @@
* 买单
*/
onCheck() {
this.checkNumber = JSON.stringify({
u: '953d776d-b30e-41da-9a7a-a7b832cd5b93',
t: this.onGetLocalDateTime()
});
this.$refs.popup.open();
const userStorage = getApp().onGetUserStorage();
if (userStorage && userStorage.memberInfo_Id) {
this.checkNumber = JSON.stringify({
u: userStorage.memberInfo_Id,
t: this.onGetLocalDateTime()
});
this.$refs.popup.open();
}
},
/**
* 弹窗状态改变


+ 26
- 9
src/pages/storedValueActivity/storedValueActivity.vue View File

@@ -78,7 +78,7 @@
充值金额
</view>
<view class="recharge-ins-suffix">
{{activityList[activityIndex].rechargeMoney}}元
{{activityList[activityIndex].rechargeMoney || 0}}元
</view>
</view>
<view class="recharge-ins-item">
@@ -86,7 +86,7 @@
赠送金额
</view>
<view class="recharge-ins-suffix">
{{activityList[activityIndex].giveMoney}}元
{{activityList[activityIndex].giveMoney || 0}}元
</view>
</view>
<view class="recharge-ins-item">
@@ -94,7 +94,7 @@
到账金额
</view>
<view class="recharge-ins-suffix sure-money">
{{activityList[activityIndex].rechargeMoney + activityList[activityIndex].giveMoney}}元
{{activityList[activityIndex].rechargeMoney || 0 + activityList[activityIndex].giveMoney || 0}}元
</view>
</view>
</view>
@@ -106,10 +106,10 @@
<u-checkbox-group @change="onCheckboxChange">
<u-checkbox shape="circle" active-color="rgb(237, 198, 96)"></u-checkbox>
</u-checkbox-group>
<view class="read-and-agree">
<view class="read-and-agree" @click="onCheckboxChange">
已阅读并同意
</view>
<view class="aggreement-text">
<view class="aggreement-text" @click="onAgreement">
《商家会员储值服务协议》
</view>
</view>
@@ -119,10 +119,10 @@
</view>
<view class="money-number">
{{activityList[activityIndex].rechargeMoney}}
{{activityList[activityIndex].rechargeMoney || 0}}
</view>
<view class="money-account">
到账金额{{activityList[activityIndex].rechargeMoney + activityList[activityIndex].giveMoney}}元
到账金额{{activityList[activityIndex].rechargeMoney || 0 + activityList[activityIndex].giveMoney || 0}}元
</view>
</view>
<view class="confirm-recharge-btn" @click="onConfirmRecharge">
@@ -223,14 +223,23 @@
* 去买单
*/
onCheckBack() {
uni.redirectTo({
url: '/pages/storedValueAccount/storedValueAccount'
uni.navigateBack({
delta: 1
});
},
/**
* 确认充值
*/
onConfirmRecharge() {
if (this.activityList.length === 0) {
uni.showToast({
title: '该店暂未设置储值活动!',
icon: 'none',
duration: 1000,
mask: true
});
return;
}
if (this.aggreement) {
this.onConfirmPayment();
} else {
@@ -312,6 +321,14 @@
});
}
}, 5000, true),
/**
* 查看会员储值协议
*/
onAgreement() {
uni.navigateTo({
url: "/pages/storedValueAgreement/storedValueAgreement"
})
}
}
}
</script>


+ 92
- 0
src/pages/storedValueAgreement/storedValueAgreement.vue View File

@@ -0,0 +1,92 @@
<template>
<view class="agreement-container">
<view class="agreement-text">
本版本更新于:2023年5月1日
</view>
<view class="agreement-text">
本版本生效于:2023年5月1日
</view>
<view class="agreement-text">
重要提示:
</view>
<view class="agreement-text">
请您在接受使用本服务前务必先审慎阅读、充分理解本协议的相应条款,特别是免除或限制责任的条款、法律适用及争议解决条款。限制、免责、法律适用及争议解决等关系您切身利益的重要条款可能会以黑体加粗的形式提示您重点注意。
</view>
<view class="agreement-text">
会员储值服务协议(以下简称:“本协议”)是合作商户(下称:“商家”)与在该商家店铺内消费的客户(以下简称:“您”),就您成为会员并开通储值功能相关事项所订立的有效协议。您通过网络页面勾选“同意”或以其他方式选择接受本协议,即表示您已经理解本协议内容并同意受本协议约束,包括但不限于本协议正文及已经发布的或将来可能发布的关于本服务的各类规则、规范、公告、说明或通知等,以及其他各项网站规则、制度等。所有前述规则为本协议不可分割的组成部分,与本协议正文具有同等的法律效力。
</view>
<view class="agreement-text">
除非您已阅读并同意本协议所有内容,否则您无权使用本协议项下的服务。如您同意购买或使用本协议下的服务,即表示您自愿接受本协议的所有内容。
</view>
<view class="agreement-text">
第一条 会员储值服务是商家在自己的店铺内发行并售卖的仅限于在发卡主体所属门店使用的电子虚拟卡服务,该会员储值卡内余额可抵现金使用,持卡消费者每次消费时仅支付实际消费的部分,剩余款项可下次继续使用。
</view>
<view class="agreement-text">
第二条 您在购买商家储值卡或参与商家的优惠充值活动前,应仔细阅读该商家储值卡的充值及充值使用规则,包括但不限于适用门店范围、有效期、使用规则、退卡规则等,用户在购买或充值后,即视为您已经知悉并同意商家储值卡的使用规则等。
</view>
<view class="agreement-text">
第三条 如商家对储值卡的适用门店有调整的,以商家实际支持的门店为准。
</view>
<view class="agreement-text">
第四条 如您在一张商家储值卡中充值了多笔款项的,在使用时,商家将会根据商家储值卡内充值款项的充值时间、充值款项有效期等信息决定每笔充值款项的扣款顺序。
</view>
<view class="agreement-text">
第五条 如您进行储值卡充值时参与了商家的赠送活动的,在使用时,商家将根据商家的活动规则决定您的充值金额与赠送金额的扣款顺序。您在参与该充赠活动前,应向商家充分了解相应的活动规则,一旦您充值成功即视为您已经知悉并同意相应的使用规则等。
</view>
<view class="agreement-text">
第六条 当您使用商家储值卡消费后,如发生退货/退款的,您使用储值卡支付的金额将被退回该储值账户内。
</view>
<view class="agreement-text">
第七条 商家储值卡的退卡规则、退卡手续费等以商家储值卡说明页面为准。
</view>
<view class="agreement-text">
第八条 商家储值卡的具体有效期以商家储值卡说明页面为准。储值卡有效期届满后,您可向商家提出退款或延长有效期的申请;商家应根据您的申请为您办理退款或延期。
</view>
<view class="agreement-text">
第九条 您理解并同意,如商家为您办理退款或延期的,商家有可能因该退款或延期行为向您收取延期手续费,具体手续费以储值卡说明页面或您与商家协商的结果为准。
</view>
<view class="agreement-text">
第十条 商家开展其他优惠活动时,对于享受优惠的订单可能无法使用商家储值卡进行支付,具体以商家的优惠活动规则为准。
</view>
<view class="agreement-text">
第十一条 您理解您办理优惠储值业务是您和商家之间达成的合约,您购买商家储值卡后,该笔资金将直接进入到该发卡商家的资金账户,如后期发生退款、商家关闭门店或其他事由导致您无法正常消费问题,由发卡商家承担责任,您应联系发卡商家自行解决。
</view>
<view class="agreement-text">
第十二条 您确认并已知悉,商家发行储值卡,储值卡的使用和核销,及您使用商家储值卡过程中产生的体验感受、服务品质等,均由商家负责;平台展示和系统服务方,不负有任何明示或默示的担保责任。如您与商家因商家储值卡的使用而发生任何争议,包括但不限于商家提供的商品或服务的质量、价格、有效期、退货退款、退卡、售后服务、服务态度、储值卡无法使用等问题发生争议的,您应与商家采取协商或其他方式予以解决,收钱吧仅做展示服务,不负有任何的赔付义务。
</view>
<view class="agreement-text">
第十三条 您同意并认可,商家有权不定期更换商家储值卡服务规则,并以在本平台网站或其他合理方式予以公布,无需另行单独通知您。该等变更自公告载明的生效时间开始生效,并成为本协议的一部分,与本协议具有同等的法律效力。
</view>
<view class="agreement-text">
第十四条 因本协议引发的或是与本协议有关的一切争议,您应联系商家协商解决。协商解决不成的,任何一方可向上海市普陀区有管辖权的法院提起诉讼。
</view>
<view class="agreement-text">
第十五条 本协议一经您线上确认与同意,即发生法律效力,商家与您将共同受生效后的协议约束。
</view>
</view>
</template>

<script>
export default {
data() {
return {

}
},
methods: {

}
}
</script>

<style lang="scss" scoped>
.agreement-container {
padding: 20rpx;
font-size: 28rpx;
color: #666;
.agreement-text {
margin-bottom: 20rpx;
}
}
</style>

+ 3
- 2
src/pages/storedValueRecord/storedValueRecord.vue View File

@@ -13,7 +13,7 @@
{{onShowType(recordItem.transactionType)}}
</view>
<view class="record-item-money">
{{recordItem.transactionType === 2 ? '-': '+'}}{{recordItem.money}}
{{recordItem.transactionType === 2 ? '-': '+'}}{{recordItem.transactionType === 3 ? recordItem.transactionMoney : recordItem.money}}
</view>
</view>
<view class="record-item-goods">
@@ -127,9 +127,10 @@
* @param {Object} recordIndex
*/
handleNavbar(recordIndex) {
if (this.navbarIndex === recordIndex) return;
this.navbarIndex = recordIndex;
this.pageIndex = 1;
this.pageSize = 0;
this.pageSize = 10;
this.total = 0;
this.recordList = [];
}


+ 4
- 4
src/pages/welcome/welcome.vue View File

@@ -46,12 +46,12 @@
},
methods: {
onToHome() {
uni.switchTab({
url: '/pages/homeBeefWorkShop/homeBeefWorkShop'
});
// uni.switchTab({
// url: '/pages/homeNew/homeNew'
// url: '/pages/homeBeefWorkShop/homeBeefWorkShop'
// });
uni.switchTab({
url: '/pages/homeNew/homeNew'
});
},
//获取页面风格
onFetchStoreStyles() {


+ 10
- 11
src/utils/request.js View File

@@ -1,8 +1,8 @@
import Encrypt from "./crypto.js";
let BASE_URL = '';
// BASE_URL = 'https://witt.black-pa.com'; //线上正式
BASE_URL = 'https://bpa.black-pa.com:21527'; //线上开发
// BASE_URL = 'https://bpa.black-pa.com:21528'; //线上测试
// BASE_URL = 'https://witt.black-pa.com'; //线上正式
BASE_URL = 'https://bpa.black-pa.com:21527'; //线上开发
// BASE_URL = 'https://bpa.black-pa.com:21528'; //线上测试

const Franchisee = '/kitchen'; //加盟商:0
const Order = '/order'; //订单: 1
@@ -42,16 +42,15 @@ const request = (options) => {
if (options.url !== '/api/StoreHelper/GetAllStore') {
TenantId = getApp().globalData.companyId;
}
if (accountInfo.miniProgram.envVersion === 'trial') {
// 测试环境:贵州 78d635f7-8ee4-4be4-b26a-462016196826
// 正式环境贵州: a7c18ca4-04eb-4bfe-a272-3104f2d84ff1
TenantId = '78d635f7-8ee4-4be4-b26a-462016196826';
if (accountInfo.miniProgram.envVersion === 'develop') {
// 开发环境 加盟商ID
TenantId = 'a7c18ca4-04eb-4bfe-a272-3104f2d84ff1';
} else if (accountInfo.miniProgram.envVersion === 'trial') {
// 体验环境 加盟商ID
TenantId = 'a7c18ca4-04eb-4bfe-a272-3104f2d84ff1';
} else if (accountInfo.miniProgram.envVersion === 'release') {
// 正式版:正式环境:海科 01911b43-8844-4d93-b916-34208e31ba66
// 正式环境 加盟商ID
TenantId = '01911b43-8844-4d93-b916-34208e31ba66';
} else {
// 开发版:开发环境:银泰 68d4de9c-a277-4d7a-a192-e9fa91327d41
TenantId = 'a7c18ca4-04eb-4bfe-a272-3104f2d84ff1';
}
uni.request({
url: BASE_URL + interfaceType + options.url,


Loading…
Cancel
Save