Prechádzať zdrojové kódy

电子卡充值记录

Joe 4 rokov pred
rodič
commit
e7b7cec168

+ 7 - 4
assets/util/index.js

@@ -2,20 +2,20 @@ import querystring from "querystring";
 import settings from "@/settings"
 
 export const getAuthen = function () {
-  
   const search = window.location.search
  /**
- * 这一段作用是先挑战网页后再跳转
+ * 这一段作用是先跳转网页后再跳转
  **/
   if (search !== '') {
     const search = querystring.parse(window.location.search.replace("?", ''))
     let appIdPromise
+    // 有stationId
     if (!!search.stationId) {
       $nuxt.$store.commit("authen/setStationId", search.stationId)
     } else {
       alert('你没有传递站点参数');
     }
-
+    // 有appId
     if (!!search.appId) {
       $nuxt.$store.commit("authen/setAppId", search.appId)
       appIdPromise = Promise.resolve();
@@ -25,10 +25,13 @@ export const getAuthen = function () {
       })
     }
 
+    // 拿到当前地址 
     const path = window.location.pathname === "/authen" ? "/" : window.location.pathname
+    // 替换为自己的标识符号
     const searchStr = window.location.search.replace("?", ".").replace(/&/g, "-").replace(/=/g, "_")
+
     appIdPromise.then(() => {
-      window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + $nuxt.$store.getters["authen/appId"] + "&redirect_uri=" + settings.url + "%2fauthen&response_type=code&scope=snsapi_userinfo&state=" + path + searchStr + "#wechat_redirect"
+      window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + $nuxt.$store.getters["authen/appId"] + "&redirect_uri=" + settings.gotoUrl + "%2fauthen&response_type=code&scope=snsapi_userinfo&state=" + path + searchStr + "#wechat_redirect"
     })
   } else {
     alert("请传递站点参数")

+ 6 - 5
nuxt.config.js

@@ -13,14 +13,15 @@ export default {
     '@nuxtjs/proxy'
   ],
   axios: {
-    prefix:settings.prefix,
-    proxy: true
+    baseURL: settings.baseUrl + "/" + settings.prefix,
+    prefix:"/prefix",
+    proxy: settings.devEnv,
   },
   proxy: {
-    '/demo': {
-      target: 'https://www.huijy.net/',
+    '/prefix': {
+      target: settings.baseUrl,
       pathRewrite: {
-        '^/demo' : '/demo'
+        '^/prefix' : "/" + settings.prefix
       }
     }
   },

+ 94 - 50
pages/charge/amount.vue

@@ -3,11 +3,11 @@
     <div class="container">
       <div class="overview">
         <div class="title">会员余额(¥)</div>
-        <div class="gasoline">
-          汽油卡:<span>{{ this.gasolineAmount | toFixed }}</span>
-        </div>
-        <div class="diesel">
-          柴油卡:<span>{{ this.dieselAmount | toFixed }}</span>
+        <div class="card">
+          <div v-if="cardList.length == 0">所在油站未启动电子卡功能</div>
+          <div  v-for="ele in cardList" :key="ele.id">
+            {{cardOilsTypeText[ele.cardOilsType]}}:<span>{{ ele.amt | toFixed }}</span>
+          </div>          
         </div>
         <div class="pay">
           <span class="icon"></span>
@@ -29,7 +29,7 @@
         </div>
       </div>
       <div class="content">
-        <div v-if="showList.length=== 0" class="no-img">
+        <div v-if="showList.length === 0" class="no-img">
           <div></div>
           <span>无记录</span>
         </div>
@@ -37,9 +37,12 @@
           <div class="ele" v-for="(item, index) in showList" :key="index">
             <div class="title">
               <span class="text">{{
-                item.cardOilsType == "1" ? "汽油卡" : "柴油卡"
+                cardOilsTypeText[item.cardOilsType]
               }}</span>
-              <span class="amount"
+              <span class="amount" v-if="item.usageType == '-'"
+                >{{ item.usageType }} {{ +item.amt | toFixed }}</span
+              >
+              <span class="amount" v-else
                 >{{ item.usageType }}
                 {{ (+item.amt + +item.presentAmt) | toFixed }}</span
               >
@@ -88,6 +91,8 @@ export default {
       type: 0, //0全部 1充值 2支出
       gasolineAmount: 0,
       dieselAmount: 0,
+      cardOilsTypeText: [, "汽油卡", "柴油卡", "非油卡", "LNG卡", "CNG卡"],
+      cardList:[]
     };
   },
   computed: {
@@ -115,10 +120,72 @@ export default {
   },
   created() {
     this.init();
-    console.log("user.info",this.userInfo)
+    console.log("user.info", this.userInfo);
   },
   methods: {
     async init() {
+      // const data = [
+      //   {
+      //     id: 105,
+      //     unionId: "o65PX6a8gYoXrRtsay4nid7vaN-k",
+      //     customerNo: "11622424586654",
+      //     customerName: "Joe",
+      //     amt: 55455.82,
+      //     cardOilsType: "1",
+      //     stationId: 1,
+      //     createTime: "Jun 4, 2021 2:16:29 PM",
+      //     recentlyTime: "Jun 4, 2021 2:14:33 PM",
+      //   },
+      //   {
+      //     id: 106,
+      //     unionId: "o65PX6a8gYoXrRtsay4nid7vaN-k",
+      //     customerNo: "11619582798963",
+      //     customerName: "Joe",
+      //     amt: 10005.06,
+      //     cardOilsType: "2",
+      //     stationId: 1,
+      //     createTime: "Jun 4, 2021 2:16:29 PM",
+      //     recentlyTime: "Jun 2, 2021 5:22:39 PM",
+      //   },
+      //   {
+      //     id: 115,
+      //     unionId: "o65PX6a8gYoXrRtsay4nid7vaN-k",
+      //     customerNo: "11622424586607",
+      //     customerName: "Joe",
+      //     amt: 55555,
+      //     cardOilsType: "3",
+      //     stationId: 1,
+      //     createTime: "Jun 4, 2021 2:16:29 PM",
+      //   },
+      //   {
+      //     id: 116,
+      //     unionId: "o65PX6a8gYoXrRtsay4nid7vaN-k",
+      //     customerNo: "11622424586654",
+      //     customerName: "Joe",
+      //     amt: 55555,
+      //     cardOilsType: "4",
+      //     stationId: 1,
+      //     createTime: "Jun 4, 2021 2:16:29 PM",
+      //   },
+      //   {
+      //     id: 119,
+      //     unionId: "o65PX6a8gYoXrRtsay4nid7vaN-k",
+      //     customerNo: "11622538683941",
+      //     customerName: "Joe",
+      //     amt: 0,
+      //     cardOilsType: "5",
+      //     stationId: 1,
+      //     createTime: "Jun 4, 2021 2:16:29 PM",
+      //   },
+      // ];
+      // data.forEach((ele) => {
+      //   if (ele.cardOilsType == "1") {
+      //     this.gasolineAmount = ele.amt;
+      //   } else if (ele.cardOilsType == "2") {
+      //     this.dieselAmount = ele.amt;
+      //   }
+      // });
+      // this.cardList = data
       // 获取油站列表
       this.$axios
         .$get("/getElectronicCardList", {
@@ -128,19 +195,11 @@ export default {
           },
         })
         .then((res) => {
-          console.log(res);
           if (res.retCode === 0) {
-            res.data.forEach((ele) => {
-              console.log(ele);
-              if (ele.cardOilsType == "1") {
-                this.gasolineAmount = ele.amt;
-              } else if (ele.cardOilsType == "2") {
-                this.dieselAmount = ele.amt;
-              }
-            });
+            this.cardList = res.data
           }
-        }).catch((e)=>{
         })
+        .catch((e) => {});
 
       // 获取订单
       try {
@@ -151,6 +210,7 @@ export default {
             usageType: "",
           },
         });
+
         if (amountData.retCode !== 0) {
           throw new Error(amountData.message);
         }
@@ -202,50 +262,34 @@ export default {
   left: 0.6rem;
   top: 0.3rem;
 }
-.charge-amount .container .overview .gasoline {
-  height: 0.6rem;
-  font-size: 0.28rem;
-  font-family: PingFangSC-Semibold, PingFang SC;
-  font-weight: 600;
-  color: #ffffff;
-  line-height: 0.6rem;
+.charge-amount .container .overview >.card{
   position: absolute;
-  top: 1rem;
   left: 0.6rem;
+  top: 0.9rem;
+  width:5.8rem;
+  height:1.8rem;
+  display: flex;
+  flex-wrap: wrap;
+  justify-content:space-between;
+  align-content:space-around;
 }
-
-.charge-amount .container .overview .gasoline span {
-  height: 0.6rem;
-  font-size: 0.4rem;
-  font-weight: 600;
-  line-height: 0.6rem;
-}
-
-.charge-amount .container .overview .diesel {
-  height: 0.6rem;
+.charge-amount .container .overview >.card div{
   font-size: 0.28rem;
-  font-family: PingFangSC-Semibold, PingFang SC;
-  font-weight: 600;
   color: #ffffff;
-  line-height: 0.6rem;
-  position: absolute;
-  top: 1.75rem;
-  left: 0.6rem;
+  font-weight: 500;
 }
-.charge-amount .container .overview .diesel span {
-  height: 0.6rem;
-  font-size: 0.4rem;
+.charge-amount .container .overview >.card div span{
   font-weight: 600;
-  line-height: 0.6rem;
+  font-size: 0.4rem;
 }
 
 .charge-amount .container .overview .pay {
-  width: 1.56rem;
-  height: 0.6rem;
+  width: 1.4rem;
+  height: 0.5rem;
   border-radius: 0.39rem;
   border: 0.02rem solid #ffffff;
   position: absolute;
-  top: 1.3rem;
+  top: 0.25rem;
   right: 0.6rem;
   display: flex;
   align-items: center;

+ 53 - 52
pages/charge/index.vue

@@ -7,25 +7,16 @@
       </div>
     </div>
     <div class="content">
-      <div class="title">我的卡片 ({{ cardList.length }})</div>
+      <div class="title">我的卡片  ({{ cardList.length }})</div>
+      <div class="title"></div>
       <div
         v-for="item in cardList"
         :key="item.id"
-        :class="[
-          item.cardOilsType == 1
-            ? 'gasoline'
-            : item.cardOilsType == 2
-            ? 'diesel'
-            : '',
-        ]"
+        :class="[cardOilsTypeClass[item.cardOilsType]]"
       >
         <div class="title">
           {{
-            item.cardOilsType == 1
-              ? "汽油卡"
-              : item.cardOilsType == 2
-              ? "柴油卡"
-              : ""
+              cardOilsTypeText[item.cardOilsType]
           }}
         </div>
         <div class="text">
@@ -36,17 +27,14 @@
       </div>
     </div>
 
+
     <van-popup v-model="mask" closeable position="bottom" class="mask" round>
       <div class="charge">
         <div class="title">充值</div>
         <div class="tip">会员日充值更优惠,详情请咨询站长</div>
         <div class="amount">
           <span>{{
-            chargeItem.cardOilsType == 1
-              ? "汽油充值"
-              : chargeItem.cardOilsType == 2
-              ? "柴油充值"
-              : ""
+              cardOilsTypeText[chargeItem.cardOilsType]
           }}</span>
           <input
             placeholder="输入充值金额"
@@ -112,6 +100,8 @@ export default {
       payLoading: false,
       show: false,
       discountList: [],
+      cardOilsTypeClass:[,"gasoline", "diesel", 'notoil', 'lng', 'cng'],
+      cardOilsTypeText:[,'汽油卡','柴油卡','非油品卡','LNG卡','CNG卡']
     };
   },
   components: {
@@ -129,12 +119,12 @@ export default {
     this.init();
   },
   methods: {
-    onInput(value) {
-      Toast(value);
-    },
-    onDelete() {
-      Toast("删除");
-    },
+    // onInput(value) {
+    //   Toast(value);
+    // },
+    // onDelete() {
+    //   Toast("删除");
+    // },
     ...mapActions({
       getSdkConfig: "authen/getSdkConfig",
     }),
@@ -178,8 +168,10 @@ export default {
         .then((res) => {
           if (res.retCode === 0) {
             this.cardList = res.data;
+            console.log(this.cardList)
           }
         });
+      // this.cardList = [{"id":105,"unionId":"o65PX6a8gYoXrRtsay4nid7vaN-k","customerNo":"11622424586654","customerName":"Joe","amt":55455.83,"cardOilsType":"1","stationId":1,"createTime":"Jun 3, 2021 10:29:58 AM","recentlyTime":"Jun 2, 2021 5:22:26 PM"},{"id":106,"unionId":"o65PX6a8gYoXrRtsay4nid7vaN-k","customerNo":"11619582798963","customerName":"Joe","amt":10005.06,"cardOilsType":"2","stationId":1,"createTime":"Jun 3, 2021 10:29:58 AM","recentlyTime":"Jun 2, 2021 5:22:39 PM"},{"id":115,"unionId":"o65PX6a8gYoXrRtsay4nid7vaN-k","customerNo":"11622424586607","customerName":"Joe","amt":55555,"cardOilsType":"3","stationId":1,"createTime":"Jun 3, 2021 10:29:58 AM"},{"id":116,"unionId":"o65PX6a8gYoXrRtsay4nid7vaN-k","customerNo":"11622424586654","customerName":"Joe","amt":55555,"cardOilsType":"4","stationId":1,"createTime":"Jun 3, 2021 10:29:58 AM"},{"id":119,"unionId":"o65PX6a8gYoXrRtsay4nid7vaN-k","customerNo":"11622538683941","customerName":"Joe","amt":0,"cardOilsType":"5","stationId":1,"createTime":"Jun 3, 2021 10:29:58 AM"}]
       // 这一块纯为了后端方便而已,获取station的信息
       this.$axios
         .$get("/getStationInfo", {
@@ -194,33 +186,22 @@ export default {
     async pay() {
       try {
         this.payLoading = true;
-        const orderData = await this.$axios.$post("/rechargeBalance", {
+        const orderData = await this.$axios.$post("http://mp.huijy.net/test/rechargeBalance", {
           amt: this.chargeAmount,
           stationId: this.stationId,
           customerName: this.userInfo.nickname,
           cardOilsType: this.chargeItem.cardOilsType,
-          payType: "1",
           unionId: this.unionId,
-          stationName: this.stationInfo.stationName,
         });
         if (orderData.retCode !== 0) {
           throw new Error("生成订单失败");
         }
         const orderNum = orderData.data;
-        const subject =
-          this.stationInfo.stationName +
-          "_" +
-          (this.chargeItem.cardOilsType == 1
-            ? "汽油电子卡充值"
-            : this.chargeItem.cardOilsType == 2
-            ? "柴油电子卡充值"
-            : "");
-        const payInfoData = await this.$axios.$post("/rechargeBalanceSXFPay", {
+        const payInfoData = await this.$axios.$post("http://mp.huijy.net/test/rechargeBalanceSXFPay", {
           amt: this.chargeAmount,
           openId: this.openId,
           stationId: this.stationId,
           userType: "1",
-          subject,
           orderNo: orderNum,
         });
         if (payInfoData.retCode !== 0) {
@@ -253,7 +234,6 @@ export default {
               signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
               paySign, // 支付签名
               success: function (res) {
-                // that.$router.push("/personal/charge");
                 that.payLoading = false;
                 alert("支付完成");
               },
@@ -332,8 +312,7 @@ export default {
   background-color: #ffffff;
   border-radius: 0.3rem 0.3rem 0 0;
   padding: 0.3rem;
-  display: flex;
-  flex-direction: column;
+  overflow: scroll;
 }
 .charge-index .content > div:not(.title) {
   width: 6.9rem;
@@ -354,6 +333,18 @@ export default {
   background: url("~static/personal/bj4@2x.png") no-repeat 0px 0px;
   background-size: 100% 100%;
 }
+.charge-index .content .notoil {
+  background: url("~static/personal/bj5.2x.png") no-repeat 0px 0px;
+  background-size: 100% 100%;
+}
+.charge-index .content .lng {
+  background: url("~static/personal/bj6.2x.png") no-repeat 0px 0px;
+  background-size: 100% 100%;
+}
+.charge-index .content .cng {
+  background: url("~static/personal/bj7.2x.png") no-repeat 0px 0px;
+  background-size: 100% 100%;
+}
 .charge-index .content div .title {
   height: 0.45rem;
   font-size: 0.32rem;
@@ -365,27 +356,29 @@ export default {
   top: 0.27rem;
   left: 1.67rem;
 }
-.charge-index .content .gasoline .text {
+.charge-index .content div .text{
   height: 0.45rem;
   font-size: 0.32rem;
-  font-family: PingFangSC-Medium, PingFang SC;
   font-weight: 500;
-  color: #3db58f;
   line-height: 0.45rem;
   position: absolute;
   top: 0.9rem;
   left: 1.67rem;
 }
+.charge-index .content .gasoline .text {
+  color: #3db58f;
+}
 .charge-index .content .diesel .text {
-  height: 0.45rem;
-  font-size: 0.32rem;
-  font-family: PingFangSC-Medium, PingFang SC;
-  font-weight: 500;
   color: #ea8c7d;
-  line-height: 0.45rem;
-  position: absolute;
-  top: 0.9rem;
-  left: 1.67rem;
+}
+.charge-index .content .notoil .text {
+  color: #898d92;
+}
+.charge-index .content .lng .text {
+  color: #dab899;
+}
+.charge-index .content .cng .text {
+  color: #6977b1;
 }
 
 .charge-index .content div .text span {
@@ -407,10 +400,18 @@ export default {
 .charge-index .content .gasoline button {
   color: #24ac81;
 }
-
 .charge-index .content .diesel button {
   color: #e87d6d;
 }
+.charge-index .content .notoil button {
+  color: #6d7278;
+}
+.charge-index .content .lng button {
+  color: #d2a781;
+}
+.charge-index .content .cng button {
+  color: #45579e;
+}
 
 .charge-index .mask .charge {
   height: 7.5rem;

+ 12 - 10
settings.js

@@ -1,14 +1,16 @@
 export default {
-  // url:"http://www.onlyfido.top",
-  // url:"http://m.huijy.net",
-  url:"http://www.huijy.net",
+  baseUrl: 'http://mp.huijy.net',
+  // gotoUrl:"http://www.onlyfido.top",
+  gotoUrl:"http://mp.huijy.net",
+  // url:"http://www.huijy.net",
 
+  devEnv:false,
   debug: false,
-  prefix:"/api",
-  // prefix:"/demo",
+
+  // prefix:"/api",
+  prefix:"test",
   port: 8081,
-    // host: '192.168.3.14' // default: localhost
-    host:"localhost",
-    // host:"192.168.31.87",
-  
-}
+    // host: '192.168.3.14', // default: localhost
+    // host:"localhost",
+  host:"192.168.31.87",
+}

BIN
static/personal/bj5.2x.png


BIN
static/personal/bj6.2x.png


BIN
static/personal/bj7.2x.png