From beb907a07790d4eb9a90496bb344937a59b98b96 Mon Sep 17 00:00:00 2001
From: huliyong <2783385703@qq.com>
Date: Mon, 7 Oct 2024 14:59:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A8=E5=B9=BF=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E3=80=81=E7=AC=AC=E4=BA=8C=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 2 +-
api/api.js | 17 +-
main.js | 5 +
pages/center/center.vue | 53 ++++++-
pages/payment/payment.vue | 157 +++++++++++++++----
pages/promotion/promotion.vue | 198 ++++++++++++++++++++++--
pages/weddingCelebration/weddingCelebration.vue | 8 +-
store/store.js | 60 +++++--
8 files changed, 425 insertions(+), 75 deletions(-)
diff --git a/App.vue b/App.vue
index b907221..0ad5d4d 100644
--- a/App.vue
+++ b/App.vue
@@ -4,7 +4,7 @@
this.$store.commit('initConfig')
},
onShow: function() {
- // this.$store.commit('initConfig')
+ this.$store.commit('getGasStationList')
},
onHide: function() {
}
diff --git a/api/api.js b/api/api.js
index 4272ca5..8c1b2ff 100644
--- a/api/api.js
+++ b/api/api.js
@@ -10,13 +10,13 @@ const config = {
// 获取个人信息接口
infoGetInfo: { url: '/cheer/info/getInfo', method: 'GET', auth: true, showLoading : true },
//下单
- createOrderPay: { url: '/cheer/info/createOrderPay', method: 'GET', auth: true, limit : 2000, showLoading : true },
+ // createOrderPay: { url: '/cheer/info/createOrderPay', method: 'GET', auth: true, limit : 2000, showLoading : true },
//获取折扣、客户电话、微信
- getConfig: { url: '/cheer/info/getConfig', method: 'GET'},
+ // getConfig: { url: '/cheer/info/getConfig', method: 'GET'},
//获取充值套餐
- getRechargePage: { url: '/cheer/info/getRechargePage', method: 'GET'},
+ // getRechargePage: { url: '/cheer/info/getRechargePage', method: 'GET'},
//获取加油流水订单
- getOrderWaterPage: { url: '/cheer/info/getOrderWaterPage', method: 'GET', showLoading : true },
+ // getOrderWaterPage: { url: '/cheer/info/getOrderWaterPage', method: 'GET', showLoading : true },
//获取隐私政策
getPrivacyPolicy: { url: '/cheer/login/getPrivacyPolicy', method: 'GET'},
//获取用户协议
@@ -24,7 +24,7 @@ const config = {
/**
- * 新版本接口
+ * 新版本接口
*/
//根据加油站标识获取相关配置信息
twogetConfig: { url: '/cheer/two/getConfig', method: 'GET'},
@@ -34,10 +34,15 @@ const config = {
twogetOrderWaterPage: { url: '/cheer/two/getOrderWaterPage', method: 'GET'},
//根据加油站标识获取加油站充值套餐信息
twogetRechargeList: { url: '/cheer/two/getRechargeList', method: 'GET'},
+ //获取推广二维码
+ getQrCode: { url: '/cheer/two/getQrCode', method: 'GET'},
+ //查询当前用户是否是管理员
+ isAdmin: { url: '/cheer/two/isAdmin', method: 'GET'},
+ //用户输入支付创建支付订单并且支付
+ twocreateOrderPay: { url: '/cheer/two/createOrderPay', method: 'POST'},
}
-
export function api(key, data, callback, loadingTitle) {
let req = config[key]
diff --git a/main.js b/main.js
index f5cd3ba..dba12c4 100644
--- a/main.js
+++ b/main.js
@@ -5,6 +5,7 @@ import Vue from 'vue'
import './uni.promisify.adaptor'
+
Vue.config.productionTip = false
App.mpType = 'app'
@@ -15,6 +16,7 @@ import i18n from './locale/index.js'
import './config'
import './utils/index.js'
+
//组件注册
import configPopup from '@/components/config/configPopup.vue'
import changeLanguage from '@/components/base/changeLanguage.vue'
@@ -28,6 +30,9 @@ const app = new Vue({
i18n
})
app.$mount()
+
+
+
// #endif
// #ifdef VUE3
diff --git a/pages/center/center.vue b/pages/center/center.vue
index a118fb7..7679f76 100644
--- a/pages/center/center.vue
+++ b/pages/center/center.vue
@@ -37,20 +37,41 @@
登录 / 注册
+
+
+ 推广
+
-
+
+
+
+
+
+
- {{ item.id }}
{{ item.createTime }}
+ {{ item.state_dictText }}
付款金额
@@ -60,6 +81,15 @@
{{ item.oldPrice }}
+
+ 订单号:{{ item.id }}
+
+
+ 站点:{{ item.shopId }}
+
+
+ 油号:{{ item.name }}
+
@@ -87,13 +117,15 @@
pageSize: 10
},
orderList: [],
- total: 0
+ total: 0,
+ isAdminResult : false,
}
},
onShow() {
if (uni.getStorageSync('token')) {
this.$store.commit('getUserInfo')
this.getOrderList()
+ this.isAdmin()
}
},
//滚动到屏幕底部
@@ -106,11 +138,19 @@
methods: {
//获取订单列表
getOrderList() {
- this.$api('getOrderWaterPage', this.queryParams, res => {
+ this.$api('twogetOrderWaterPage', this.queryParams, res => {
this.orderList = res.result.records
this.total = res.result.total
})
},
+ //检查是否为管理员
+ isAdmin() {
+ this.$api('isAdmin', res => {
+ if(res.code == 200){
+ this.isAdminResult = !!res.result
+ }
+ })
+ },
//跳转推广页面
toPromotion(){
@@ -216,20 +256,19 @@
}
.order-item {
- width: 100%;
background: white;
border-radius: 20rpx;
margin-bottom: 20rpx;
+ padding: 20rpx;
}
.order-item .order-item-top {
display: flex;
align-items: center;
justify-content: space-between;
- height: 80rpx;
font-size: 24rpx;
box-sizing: border-box;
- padding: 0rpx 20rpx;
+ padding: 10rpx 20rpx;
}
.order-item .order-item-main {
diff --git a/pages/payment/payment.vue b/pages/payment/payment.vue
index 21fc377..819f8fc 100644
--- a/pages/payment/payment.vue
+++ b/pages/payment/payment.vue
@@ -4,13 +4,42 @@
+ {{ scene }}
+
+
+
+
+
+ {{ gasStation.name }}
+
+
+
+
+ 选择站点
+
+
+
+
+
+
- {{ configList.title.keyCentent }}
- {{ configList.price.keyCentent }}
+ {{ configList.title }}
+ {{ configList.price }}
@@ -25,7 +54,7 @@
折后共计{{
(form.money *
(configList.preferential ?
- configList.preferential.keyCentent
+ configList.preferential
: 1)).toFixed(2)
}}元
@@ -53,12 +82,35 @@
@trigger="clickMenu" /> -->
+ @click="clickService(configList.phone)">
+
+
+
+
+
+ 请选择加油站
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
@@ -72,7 +124,7 @@
PrivacyAgreementPoup
},
computed : {
- ...mapState(['configList']),
+ ...mapState(['configList', 'gasStationList', 'gasStation']),
},
data() {
return {
@@ -90,32 +142,40 @@
horizontal: 'right',
vertical: 'bottom',
direction: 'vertical',
- rechargeList : []
+ rechargeList : [],
+ scene : '',
}
},
onShow() {
- // if (wx.onNeedPrivacyAuthorization) {
- // console.log('onNeedPrivacyAuthorization');
- // wx.onNeedPrivacyAuthorization(resolve => {
- // console.log('onNeedPrivacyAuthorization');
- // this.resolvePrivacyAuthorization = resolve
- // this.$refs.showPrivacy.init(resolve)
- // })
- // }
- // wx.getPrivacySetting({
- // success: res => {
- // console.log(res)
- // if (res.needAuthorization) {
- // // 需要弹出隐私协议
- // this.$refs.showPrivacy.init()
- // }
- // },
- // fail: () => {}
- // })
- this.getRechargePage()
+ if(!this.scene && !this.gasStation.id){
+ this.$refs.popup.open()
+ }else{
+ this.gasStationList.forEach(n => {
+ if(n.id == this.scene){
+ this.$store.commit('setGasStation', n)
+ }
+ })
+ this.$nextTick(n => {
+ this.getRechargePage()
+ })
+ }
+ },
+ onLoad (query) {
+ // scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
+ const scene = decodeURIComponent(query.scene || '')
+ this.scene = scene
},
methods: {
+ setGasStation(data){
+ this.$store.commit('setGasStation', data)
+ this.$refs.popup.close()
+
+ this.$nextTick(n => {
+ this.getRechargePage()
+ })
+ },
+
// 用户选择加油金额
selectMoney(money, item) {
this.form.money = money
@@ -137,6 +197,9 @@
},
submit() {
+ if (!this.gasStation.id) {
+ return this.$refs.popup.open()
+ }
if (!uni.getStorageSync('token')) {
return uni.navigateTo({
url: '/pages/login/login'
@@ -144,7 +207,7 @@
}
let money = (this.form.money *
(this.configList.preferential ?
- this.configList.preferential.keyCentent
+ this.configList.preferential
: 1)).toFixed(2)
// if(!money){
@@ -154,8 +217,9 @@
// })
// }
- this.$api('createOrderPay', {
- money
+ this.$api('twocreateOrderPay', {
+ money,
+ shopId : this.gasStation.id,
}, res => {
this.form.money = ''
if(res.code == 200){
@@ -191,7 +255,9 @@
//获取充值套餐
getRechargePage(){
- this.$api('getRechargePage', res => {
+ this.$api('twogetRechargeList', {
+ id : this.gasStation.id
+ }, res => {
this.rechargeList = res.result.records
})
},
@@ -210,10 +276,43 @@
\ No newline at end of file
diff --git a/pages/weddingCelebration/weddingCelebration.vue b/pages/weddingCelebration/weddingCelebration.vue
index 53a6154..b2f6e55 100644
--- a/pages/weddingCelebration/weddingCelebration.vue
+++ b/pages/weddingCelebration/weddingCelebration.vue
@@ -5,21 +5,21 @@
微信号:
-
+
- {{ configList.wx.keyCentent }}
+ {{ configList.wx }}
手机号:
-
+
- {{ configList.phone.keyCentent }}
+ {{ configList.phone }}
diff --git a/store/store.js b/store/store.js
index 227c636..6768de0 100644
--- a/store/store.js
+++ b/store/store.js
@@ -8,8 +8,18 @@ import api from '@/api/api.js'
//Vuex.Store 构造器选项
const store = new Vuex.Store({
state: {
- configList: {}, //配置对象
+ configList: {
+ phone: "",
+ preferential: 1,
+ price: 6.66,
+ privacyAgreement: "隐私政策",
+ title: "#95",
+ userAgreement: "用户协议",
+ wx: "",
+ }, //配置对象
userInfo : {},
+ gasStationList : [],
+ gasStation : {},
},
getters: {
getConfig(state){
@@ -19,16 +29,16 @@ const store = new Vuex.Store({
mutations: {
// 初始化配置
initConfig(state) {
- let config = ['preferential', 'wx', 'phone', 'price', 'title']
- config.forEach(k => {
- api('getConfig', {
- keyValue : k
- }, res => {
- if (res.code == 200) {
- state.configList[k] = res.result
- }
- })
- })
+ // let config = ['preferential', 'wx', 'phone', 'price', 'title']
+ // config.forEach(k => {
+ // api('getConfig', {
+ // keyValue : k
+ // }, res => {
+ // if (res.code == 200) {
+ // state.configList[k] = res.result
+ // }
+ // })
+ // })
let apiConfig = [ 'getPrivacyPolicy' , 'getUserAgreement' ] //需要访问不同接口才能得到的配置数据
let key = ['privacyAgreement','userAgreement']
@@ -38,13 +48,39 @@ const store = new Vuex.Store({
})
})
},
+ twogetConfig(state){
+ api('twogetConfig', {
+ shopId : state.gasStation.id
+ }, res => {
+ if (res.code == 200) {
+ ['preferential', 'wx', 'phone', 'price', 'title']
+ .forEach(n => {
+ state.configList[n] = res.result[n]
+ })
+ }
+ })
+ },
+ //获取加油站列表
+ getGasStationList(state){
+ api('getGasStationList', {
+ pageNo : 1,
+ pageSize : 9999999
+ }, res => {
+ if(res.code == 200){
+ state.gasStationList = res.result.records
+ }
+ })
+ },
+ setGasStation(state, data){
+ state.gasStation = data
+ this.commit('twogetConfig')
+ },
login(state) {
uni.showLoading({
title:"登录中..."
})
uni.login({
success(res) {
- console.log(res);
if (res.errMsg != "login:ok") {
return
}