Joe преди 4 години
родител
ревизия
236695d42f
променени са 5 файла, в които са добавени 434 реда и са изтрити 324 реда
  1. 407 0
      pages/charge/amount.vue
  2. 27 29
      pages/charge/index.vue
  3. 0 0
      pages/order/index.vue
  4. 0 293
      pages/others/amount.vue
  5. 0 2
      pages/point/bill.vue

+ 407 - 0
pages/charge/amount.vue

@@ -0,0 +1,407 @@
+<template>
+  <div class="outer">
+    <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>
+        <div class="pay">
+          <span class="icon"></span>
+          <router-link to="/charge/" tag="span" class="text">充值</router-link>
+        </div>
+      </div>
+      <div class="detail">
+        <div class="title">金额明细</div>
+        <div class="part">
+          <div :class="[type === 0 ? 'active' : '']" @click="selectType(0)">
+            全部
+          </div>
+          <div :class="[type === 1 ? 'active' : '']" @click="selectType(1)">
+            充值
+          </div>
+          <div :class="[type === 2 ? 'active' : '']" @click="selectType(2)">
+            支出
+          </div>
+        </div>
+      </div>
+      <div class="content">
+        <div v-if="showList.length === 0" class="no-img">
+          <div></div>
+          <span>无记录</span>
+        </div>
+        <template v-else>
+          <div class="ele" v-for="(item, index) in showList" :key="index">
+            <div class="title">
+              <span class="text">{{
+                item.cardOilsType == "1" ? "汽油卡" : "柴油卡"
+              }}</span>
+              <span class="amount"
+                >{{ item.usageType }}
+                {{ (+item.amt + +item.presentAmt) | toFixed }}</span
+              >
+            </div>
+            <div class="item">
+              <span class="text">{{
+                item.usageType == "+" ? "充值金额" : "消费金额"
+              }}</span>
+              <span class="amount">{{ item.amt | toFixed }}</span>
+            </div>
+            <div class="item" v-if="item.usageType === '+'">
+              <span class="text">赠送金额{{ item.usageType }}</span>
+              <span class="amount">{{ item.presentAmt | toFixed }}</span>
+            </div>
+            <div class="item">
+              <span class="text">{{
+                item.usageType == "+" ? "充值时间" : "消费时间"
+              }}</span>
+              <span class="amount">{{ item.createTime }}</span>
+            </div>
+          </div>
+        </template>
+        <template>
+          <div></div>
+        </template>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import ProductList from "../../components/ProductList";
+import moment from "moment";
+
+export default {
+  head() {
+    return {
+      title: "积分订单",
+    };
+  },
+  data() {
+    return {
+      allList: [],
+      showList: [],
+      type: 0, //0全部 1充值 2支出
+      gasolineAmount: 0,
+      dieselAmount: 0,
+    };
+  },
+  computed: {
+    chargeList() {
+      return this.allList.filter((ele) => {
+        return ele.usageType === "+";
+      });
+    },
+    payList() {
+      return this.allList.filter((ele) => {
+        return ele.usageType === "-";
+      });
+    },
+  },
+  filters: {
+    toFixed: function (value) {
+      return (+value).toFixed(2);
+    },
+  },
+  components: {
+    ProductList,
+  },
+  beforeCreate() {},
+  created() {
+    this.init();
+  },
+  methods: {
+    async init() {
+      // 获取油站列表
+      this.$axios
+        .$get("/getElectronicCardList", {
+          params: {
+            unionId: this.unionId,
+            stationId: this.stationId,
+          },
+        })
+        .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;
+              }
+            });
+          }
+          console.log(this.gasolineAmount, this.dieselAmount);
+        });
+
+      // 获取订单
+      try {
+        const amountData = await this.$axios.$get("/getCardRecordList", {
+          params: {
+            stationId: this.stationId,
+            unionId: this.unionId,
+            usageType: "",
+          },
+        });
+        if (amountData.retCode !== 0) {
+          throw new Error(amountData.message);
+        }
+        this.allList = amountData.data.map((ele) => {
+          ele.createTime = moment(ele.createTime, "MMM DD, YYYY HH:mm:ss A")
+            .utc()
+            .format("YYYY/MM/DD HH:mm:ss");
+          return ele;
+        });
+        this.showList = this.allList;
+      } catch (error) {
+        alert(error);
+      }
+    },
+    selectType(type) {
+      this.type = type;
+      const typeArr = ["allList", "chargeList", "payList"];
+      this.showList = this[typeArr[type]];
+    },
+  },
+};
+</script>
+
+<style>
+.outer {
+  width: 100%;
+  height: 16.24rem;
+  background: #ffffff;
+}
+.outer .container {
+  width: 6.9rem;
+  margin: 0 auto;
+}
+.outer .container .overview {
+  width: 6.9rem;
+  height: 2.8rem;
+  background: url("../../static/point/4_b01_bj@2x.png") no-repeat;
+  background-size: 100% 100%;
+  position: relative;
+}
+.outer .container .overview .title {
+  height: 0.4rem;
+  font-size: 0.28rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  line-height: 0.4rem;
+  position: absolute;
+  left: 0.6rem;
+  top: 0.3rem;
+}
+.outer .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;
+  position: absolute;
+  top: 1rem;
+  left: 0.6rem;
+}
+
+.outer .container .overview .gasoline span {
+  height: 0.6rem;
+  font-size: 0.4rem;
+  font-weight: 600;
+  line-height: 0.6rem;
+}
+
+.outer .container .overview .diesel {
+  height: 0.6rem;
+  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;
+}
+.outer .container .overview .diesel span {
+  height: 0.6rem;
+  font-size: 0.4rem;
+  font-weight: 600;
+  line-height: 0.6rem;
+}
+
+.outer .container .overview .pay {
+  width: 1.56rem;
+  height: 0.6rem;
+  border-radius: 0.39rem;
+  border: 0.02rem solid #ffffff;
+  position: absolute;
+  top: 1.3rem;
+  right: 0.6rem;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.outer .container .overview .pay .icon {
+  width: 0.3rem;
+  height: 0.3rem;
+  background: #ffffff;
+  display: inline-block;
+  background: url("../../static/point/jinbi.png") no-repeat;
+  background-size: cover;
+}
+
+.outer .container .overview .pay .text {
+  display: inline-block;
+  width: 0.56rem;
+  height: 0.6rem;
+  font-size: 0.28rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  line-height: 0.6rem;
+  margin-left: 0.2rem;
+}
+
+.outer .container .detail {
+  width: 100%;
+  height: 1.17rem;
+  display: flex;
+  justify-content: space-between;
+  border-bottom: 0.01rem solid #e0e0e0;
+}
+
+.outer .container .detail .title {
+  width: 1.28rem;
+  height: 1.17rem;
+  font-size: 0.32rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #000000;
+  line-height: 1.17rem;
+}
+.outer .container .detail .part {
+  display: flex;
+  width: 3.2rem;
+  height: 1.13rem;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.outer .container .detail .part div {
+  width: 0.64rem;
+  height: 1.13rem;
+  font-size: 0.32rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #aaaaaa;
+  line-height: 1.13rem;
+}
+.outer .container .detail .part .active {
+  width: 0.64rem;
+  height: 1.13rem;
+  font-size: 0.32rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #111111;
+  border-bottom: 0.06rem solid #db9d28;
+}
+.outer .container .content {
+  width: 100%;
+}
+.outer .container .content .no-img {
+  width: 100%;
+  height: 60vh;
+    position: relative;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+.outer .container .content .no-img div {
+  width: 2.29rem;
+  height: 1.87rem;
+  background: url("../../static/common/wu@2x.png") no-repeat 0 0;
+  background-size: 100% 100%;
+}
+.outer .container .content .no-img span {
+  width: 2.29rem;
+  height: 0.4rem;
+  font-size: 0.28rem;
+  font-weight: 500;
+  color: #aaaaaa;
+  line-height: 0.4rem;
+  text-align: center;
+}
+
+.outer .container .content .ele {
+  height: 2.7rem;
+  border-bottom: 0.01rem solid #e0e0e0;
+  padding: 0.3rem 0;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
+}
+.outer .container .content .ele .title {
+  width: 100%;
+  height: 0.45rem;
+  font-size: 0.32rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  color: #111111;
+  line-height: 0.45rem;
+  display: flex;
+  justify-content: space-between;
+}
+
+.outer .container .content .ele .title .text {
+  display: inline-block;
+  height: 0.45rem;
+  font-weight: 500;
+  color: #111111;
+}
+
+.outer .container .content .ele .title .amount {
+  display: inline-block;
+  height: 0.45rem;
+  font-weight: 500;
+  color: #db9d28;
+}
+
+.outer .container .content .ele .item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 0.15rem;
+  height: 0.4rem;
+  font-size: 0.28rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #aaaaaa;
+  line-height: 0.4rem;
+}
+
+.outer .container .content .ele .item .text {
+  display: inline-block;
+  height: 0.4rem;
+  font-size: 0.28rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #aaaaaa;
+  line-height: 0.4rem;
+}
+
+.outer .container .content .ele .item .amount {
+  display: inline-block;
+  height: 0.4rem;
+  font-size: 0.28rem;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #666666;
+  line-height: 0.4rem;
+}
+</style>

+ 27 - 29
pages/charge/index.vue

@@ -4,7 +4,7 @@
       <div class="headline"></div>
     </div>
     <div class="content">
-      <div class="title">我的卡片 (2)</div>
+      <div class="title">我的卡片 ({{ cardList.length }})</div>
       <div
         class="gasoline"
         v-for="item in cardList"
@@ -135,7 +135,7 @@ export default {
         .$get("/getElectronicCardList", {
           params: {
             unionId: this.unionId,
-            stationId: 1,
+            stationId: this.stationId,
           },
         })
         .then((res) => {
@@ -199,39 +199,37 @@ export default {
         const signType = payInfoData.data.respData.paySignType;
         const paySign = payInfoData.data.respData.paySign;
 
+        const that = this;
         // 拉取微信支付
         this.getSdkConfig([
-          "openLocation",
-          "getNetworkType",
           "chooseWXPay",
         ]).then((res) => {
           wx.config(res);
-        });
-        const that = this;
-        wx.ready(function (res) {
-          wx.chooseWXPay({
-            timestamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
-            nonceStr, // 支付签名随机串,不长于 32 位
-            package: packageOrg, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
-            signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
-            paySign, // 支付签名
-            success: function (res) {
-              // that.$router.push("/personal/charge");
-              that.payLoading = false;
-              alert("支付完成");
-            },
-            cancel: function (err) {
-              that.payLoading = false;
-              alert("您取消了付款");
-            },
-            fail: function (err) {
-              that.payLoading = false;
-              alert(err);
-            },
+          wx.ready(function (res) {
+            wx.chooseWXPay({
+              timestamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
+              nonceStr, // 支付签名随机串,不长于 32 位
+              package: packageOrg, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
+              signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
+              paySign, // 支付签名
+              success: function (res) {
+                // that.$router.push("/personal/charge");
+                that.payLoading = false;
+                alert("支付完成");
+              },
+              cancel: function (err) {
+                that.payLoading = false;
+                alert("您取消了付款");
+              },
+              fail: function (err) {
+                that.payLoading = false;
+                alert(err);
+              },
+            });
+          });
+          wx.error(function (res) {
+            alert("拉取微信Sdk配置出错");
           });
-        });
-        wx.error(function (res) {
-          alert("拉取微信Sdk配置出错");
         });
       } catch (err) {
         this.payLoading = false;

+ 0 - 0
pages/others/index.vue → pages/order/index.vue


+ 0 - 293
pages/others/amount.vue

@@ -1,293 +0,0 @@
-<template>
-  <div class="outer">
-    <div class="container">
-      <div class="overview">
-        <div class="title">会员余额(¥)</div>
-        <div class="money">89757.00</div>
-        <div class="pay">
-          <span class="icon"></span>
-          <span class="text"> 充值</span>
-        </div>
-      </div>
-      <div class="detail">
-        <div class="title">金额明细</div>
-        <div class="part">
-          <div class="active">全部</div>
-          <div class="">充值</div>
-          <div class="">支出</div>
-        </div>
-      </div>
-      <div class="content">
-        <div class="ele">
-          <div class="title">
-            <span class="text">充值</span>
-            <span class="amount">+ 1050.00</span>
-          </div>
-          <div class="item">
-            <span class="text">充值金额</span>
-            <span class="amount">1000.00</span>
-          </div>
-          <div class="item">
-            <span class="text">赠送金额</span> <span class="amount">50.00</span>
-          </div>
-          <div class="item">
-            <span class="text">充值时间</span>
-            <span class="amount">2020/09/20 18:00:00</span>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import ProductList from "../../components/ProductList";
-export default {
-  head() {
-    return {
-      title: "积分订单",
-    };
-  },
-  data() {
-    return {
-      images: [],
-      list: [],
-      loading: false, //加载状态
-      finished: false, //是否完成加载
-      refreshing: false, //是否正在上拉刷新
-      listsrc: "/test/pro.png",
-    };
-  },
-  components: {
-    ProductList,
-  },
-  beforeCreate() {},
-  created() {},
-  beforeMount() {},
-  mounted() {
-    console.log(this);
-  },
-  beforeUpdate() {},
-  updated() {},
-  beforeDestroy() {},
-  destroyed() {},
-  methods: {
-    // onLoad() {
-    //   var that = this;
-    //   that.$axios
-    //     .get("/getIntegralWaresInfoList", {
-    //       params: {
-    //         stationId: "1",
-    //       },
-    //     })
-    //     .then((res) => {
-    //       if (res.data.retCode == 0) {
-    //         that.list = res.data.data; //追加数据
-    //         // 加载状态结束
-    //         that.loading = false;
-    //         that.finished = true;
-    //         console.log(that.list);
-    //       }
-    //     });
-    // },
-    // onRefresh() {
-    //   // 清空列表数据
-    //   that.finished = true;
-    //   // 重新加载数据
-    //   // 将 loading 设置为 true,表示处于加载状态
-    //   that.loading = true;
-    //   that.onLoad();
-    // },
-  },
-};
-</script>
-
-<style>
-.outer {
-  width: 100%;
-  height: 16.24rem;
-  background: #ffffff;
-}
-.outer .container {
-  width: 6.9rem;
-  margin: 0 auto;
-}
-.outer .container .overview {
-  width: 6.9rem;
-  height: 2.8rem;
-  background: url("../../static/point/4_b01_bj@2x.png") no-repeat;
-  background-size: 100% 100%;
-  position: relative;
-}
-.outer .container .overview .title {
-  width: 1.48rem;
-  height: 0.4rem;
-  font-size: 0.28rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #ffffff;
-  line-height: 0.4rem;
-  position: absolute;
-  left: 0.6rem;
-  top: 0.6rem;
-}
-.outer .container .overview .money {
-  width: 2.2rem;
-  height: 0.7rem;
-  font-size: 0.5rem;
-  font-family: PingFangSC-Semibold, PingFang SC;
-  font-weight: 600;
-  color: #ffffff;
-  line-height: 0.7rem;
-  position: absolute;
-  top: 1.2rem;
-  left: 0.6rem;
-}
-
-.outer .container .overview .pay {
-  width: 1.56rem;
-  height: 0.6rem;
-  border-radius: 0.39rem;
-  border: 0.02rem solid #ffffff;
-  position: absolute;
-  top: 1.3rem;
-  right: 0.6rem;
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-.outer .container .overview .pay .icon {
-  width: 0.3rem;
-  height: 0.3rem;
-  background: #ffffff;
-  display: inline-block;
-  background: url("../../static/point/jinbi.png") no-repeat;
-  background-size: cover;
-}
-
-.outer .container .overview .pay .text {
-  display: inline-block;
-  width: 0.56rem;
-  height: 0.6rem;
-  font-size: 0.28rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #ffffff;
-  line-height: 0.6rem;
-  margin-left: 0.2rem;
-}
-
-.outer .container .detail {
-  width: 100%;
-  height: 1.17rem;
-  display: flex;
-  justify-content: space-between;
-  border-bottom: 0.01rem solid #e0e0e0;
-}
-
-.outer .container .detail .title {
-  width: 1.28rem;
-  height: 1.17rem;
-  font-size: 0.32rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #000000;
-  line-height: 1.17rem;
-}
-.outer .container .detail .part {
-  display: flex;
-  width: 3.2rem;
-  height: 1.13rem;
-  justify-content: space-between;
-  align-items: center;
-}
-
-.outer .container .detail .part div {
-  width: 0.64rem;
-  height: 1.13rem;
-  font-size: 0.32rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #aaaaaa;
-  line-height: 1.13rem;
-}
-.outer .container .detail .part .active {
-  width: 0.64rem;
-  height: 1.13rem;
-  font-size: 0.32rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  font-weight: 400;
-  color: #111111;
-  border-bottom: 0.06rem solid #db9d28;
-}
-.outer .container .content {
-  width: 100%;
-}
-
-.outer .container .content .ele {
-  height: 2.7rem;
-  border-bottom: 0.01rem solid #e0e0e0;
-  padding: 0.3rem 0;
-  display: flex;
-  flex-direction: column;
-  justify-content: space-around
-}
-.outer .container .content .ele .title {
-  width: 100%;
-  height: 0.45rem;
-  font-size: 0.32rem;
-  font-family: PingFangSC-Regular, PingFang SC;
-  color: #111111;
-  line-height: 0.45rem;
-  display: flex;
-  justify-content: space-between;
-}
-
-.outer .container .content .ele .title .text {
-  display: inline-block;
-  width: 0.64rem;
-  height: 0.45rem;
-  font-weight: 500;
-  color: #111111;
-}
-
-.outer .container .content .ele .title .amount {
-  display: inline-block;
-  height: 0.45rem;
-  font-weight: 500;
-  color: #db9d28;
-}
-
-.outer .container .content .ele .item{
-  display:flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-top:0.15rem; 
-height: 0.4rem;
-font-size: 0.28rem;
-font-family: PingFangSC-Regular, PingFang SC;
-font-weight: 400;
-color: #AAAAAA;
-line-height: 0.4rem;
-}
-
-.outer .container .content .ele .item .text{
-display:inline-block;
-height: 0.4rem;
-font-size: 0.28rem;
-font-family: PingFangSC-Regular, PingFang SC;
-font-weight: 400;
-color: #AAAAAA;
-line-height: 0.4rem;
-}
-
-.outer .container .content .ele .item .amount{
-display:inline-block;
-height: 0.4rem;
-font-size: 0.28rem;
-font-family: PingFangSC-Regular, PingFang SC;
-font-weight: 400;
-color: #666666;
-line-height: 0.4rem;
-}
-</style>

+ 0 - 2
pages/point/bill.vue

@@ -1,6 +1,5 @@
 <template>
   <div class="point-bill">
-  <nuxt-link  to="/personal/charge" tag="span">查看订单jjjjj</nuxt-link>
     <div class="top">
       <span class="icon"></span>
       <span class="num">{{pointInfo.points}}</span>
@@ -146,7 +145,6 @@ export default {
   top: 0.6rem;
 }
 .point-bill .top .text {
-  width: 1.12rem;
   height: 0.4rem;
   font-size: 0.28rem;
   font-family: PingFangSC-Regular, PingFang SC;