Browse Source

feat(KIP-11003): Temp parking Frontend |前端功能开关 config api

john 2 năm trước cách đây
mục cha
commit
2c21753488
2 tập tin đã thay đổi với 75 bổ sung4 xóa
  1. 68 0
      src/api/parking/index.js
  2. 7 4
      src/pages/parkingFee/mixins/parkingFee.js

+ 68 - 0
src/api/parking/index.js

@@ -174,4 +174,72 @@ export function paperCoupon(couponCode, vehicleNo) {
 
 export function updateUnionId({openId, unionId, vipCode = null}) {
   return window.requestms.put(`update-union-id?openId=${openId}&unionId=${unionId}&vipCode=${vipCode}`, {}, { loading: false });
+}
+
+
+// Temp parking Frontend |前端功能开关 config api: https://kerryprops.atlassian.net/browse/KIP-11003
+
+/* 
+新增键值对配置:
+curl --request POST \
+  --url http://localhost:8080/conf-values \
+  --header 'Content-Type: application/json' \
+  --data '{
+  "key": "key1",
+  "value": {
+    "key": "key1",
+    "value": null,
+    "description": "some desc 中文一些描述性文字",
+    "createTime": "2023-07-19 11:11:00"
+  },
+  "description": "some desc 中文一些描述性文字",
+  "createTime": "2023-07-19 11:11:00"
+}'
+ */
+export function aDDConfValues(params) {
+  return window.requestms.post(`conf-values`, params, { loading: false });
+}
+/* 
+所有配置列表:
+curl --request GET \
+  --url http://localhost:8080/conf-values/
+ */
+export function getConfValues(params) {
+  return window.requestms.get(`conf-values`, {}, { loading: false });
+}
+/* 
+查询具体key1的值:
+curl --request GET \
+  --url http://localhost:8080/conf-values/key1
+ */
+export function getConfValueOfKey(key) {
+  return window.requestms.get(`conf-values/${key}`, {}, { loading: false });
+  // return window.requestms.get(`https://qa-kip-service-internal.kerryplus.com/temporary-parking-service/conf-values/${key}`, {}, { loading: false });
+}
+/* 
+修改key1的值:
+curl --request PUT \
+  --url http://localhost:8080/conf-values/key1 \
+  --header 'Content-Type: application/json' \
+  --data '{
+  "key": "key1",
+  "value": {
+    "key": "key333",
+    "description": "ffffffffff",
+    "createTime": "2023333300"
+  },
+  "description": "sofgggggg4545字",
+  "createTime": "2023-01-11 11:11:00"
+}'
+ */
+export function putConfValueOfKey(key, params) {
+  return window.requestms.put(`conf-values/${key}`, params, { loading: false });
+}
+/* 
+删除key1:
+curl --request DELETE \
+  --url http://localhost:8080/conf-values/key1
+ */
+export function deleteConfValueOfKey(key) {
+  return window.requestms.delete(`conf-values/${key}`, {}, { loading: false });
 }

+ 7 - 4
src/pages/parkingFee/mixins/parkingFee.js

@@ -16,7 +16,7 @@ import uni from '@/utils/uniHooks';
 // import greenCom from '../components/green/home.vue';
 // import officeBlueCom from '../components/officeBlue/home.vue';
 // import purpleCom from '../components/purple/home.vue';
-import { parkingLots, qrCodes, unlicensedCarCheckIn } from '@/api/parking';
+import { parkingLots, qrCodes, unlicensedCarCheckIn, getConfValueOfKey } from '@/api/parking';
 import { reject } from 'lodash';
 
 export default {
@@ -478,13 +478,16 @@ export default {
         try {
           // 判断是否启用停车发票
           uni.showLoading()
-          const res = await getAccessH5(`${this.mallId}-invoice`);
-          if(res?.data === 1) {
+          // const res = await getAccessH5(`${this.mallId}-invoice`);
+          const res = await getConfValueOfKey('HEJIInvoiceSwitch')
+          // console.log(483, res);
+          if(res?.switch) {
             uni.hideLoading();
             // console.log(474, this.Dialog);
             this.$dialog({
               title: '温馨提示',
-              message: '小程序“停车开票”功能将从2023年8月10日起提供服务,支持开具3个月内停车记录的发票,如需停车开票,请稍后尝试或咨询服务台',
+              // message: '小程序“停车开票”功能将从2023年8月10日起提供服务,支持开具3个月内停车记录的发票,如需停车开票,请稍后尝试或咨询服务台',
+              message: res.message,
               confirmButtonColor: this.$theme[this.theme].primaryColor
             })
             // 提示用户