Selaa lähdekoodia

油卡,手机充值界面

dujingxian 4 vuotta sitten
vanhempi
commit
39df13ed5a

BIN
src/assets/image/addCardBtn@2x.png


+ 3 - 1
src/config/index.ts

@@ -50,5 +50,7 @@ export const http: any = {
     getSociallist:host +  '/dev/getSociallist',
     getBannerList:host +  '/dev/banner',
     getPolicy: host + '/dev/policy',
-    getDenomination: host + '/dev/refill/goods'
+    getDenomination: host + '/dev/refill/goods',
+    getRechargeLists: host + '/dev/refill/order/list'
+    // getPetrifactionList: host+ 'dev/refill/order/list'
 };

+ 9 - 0
src/extend/Http.ts

@@ -356,4 +356,13 @@ export default class Http {
             method: 'GET'
         });
     }
+
+    // 获取充值订单
+    async getRechargeLists(params: any = null) {
+        return this.httpClient.request({
+            url: http.getRechargeLists,
+            method: 'GET',
+            data: params,
+        });
+    }
 }

+ 1 - 1
src/router/router.ts

@@ -361,5 +361,5 @@ export default [
             showBarRightBtn: false,
             title: '充值列表'
         }
-    }
+    },
 ];

+ 35 - 31
src/views/index/oilRecharge.vue

@@ -18,21 +18,12 @@
             </span>
             <div class="cardContent">
               <div class="selectCard">选择油卡</div>
-              <el-input :value="petrifactionCard" placeholder="请输入以1开头的19位中石化加油卡号" />
+              <el-input v-model="petrifactionCard" placeholder="请输入以1开头的19位中石化加油卡号" />
               <div class="alert">
                 <img src="@/assets/image/cardAlert@2x.png" alt="">
                 <span>请仔细核对卡号,避免造成不必要的损失。</span>
               </div>
             </div>
-            <!-- 充值面额 -->
-            <div class="denomination">
-              <div>充值面额</div>
-              <div class="denominationCard" :class="{'activeBorder': idx == curSinopecIdx}" v-for="(item, idx) in sinopec" :key="item">
-                <span>{{item}}</span>
-                <i>优惠价{{item * 0.995}}元</i>
-                <div :class="{'active': idx == curSinopecIdx}"></div>
-              </div>
-            </div>
         </el-tab-pane>
         <el-tab-pane label="中国石油" name="petroleum">
           <span slot="label">
@@ -41,23 +32,27 @@
           </span>
           <div class="cardContent">
             <div class="selectCard">选择油卡</div>
-            <el-input :value="petrifactionCard" placeholder="请输入以9开头的16位中石油加油卡号" />
+            <el-input v-model="petrifactionCard" placeholder="请输入以9开头的16位中石油加油卡号" />
             <div class="alert">
               <img src="@/assets/image/cardAlert@2x.png" alt="">
               <span>请仔细核对卡号,避免造成不必要的损失。</span>
             </div>
           </div>
-          <!-- 充值面额 -->
-          <div class="denomination">
-            <div>充值面额</div>
-            <div class="denominationCard" :class="{'activeBorder': idx == curPetrochinaIdx}" v-for="(item, idx) in petrochina" :key="item">
-              <span>{{item}}</span>
-              <i>优惠价{{item * 0.995}}元</i>
-              <div :class="{'active': idx == curPetrochinaIdx}"></div>
-            </div>
-          </div>
         </el-tab-pane>
       </el-tabs>
+      <!-- 充值面额 -->
+      <div class="denomination">
+        <div>充值面额</div>
+        <div
+          class="denominationCard"
+          :class="{'activeBorder': idx == curAmountIdx}"
+          v-for="(item, idx) in oil_amount" :key="item"
+          @click="hPetrifaction(idx, item)">
+          <span>{{item}}</span>
+          <i>优惠价{{item * 0.995}}元</i>
+          <div :class="{'active': idx == curAmountIdx}"></div>
+        </div>
+      </div>
       <div class="recharfeBtn" @click="recharfeBtn">
         <img src="@/assets/image/rechargeBtn@2x.png" alt="">
       </div>
@@ -89,14 +84,12 @@ export default {
       // 石化
       petrifactionCard: '',
       // 石油
-      // 石化充值面额
-      sinopec: [],
-      // 石油面额
-      petrochina: [],
-      // 石油当前面额
-      curPetrochinaIdx: 0,
-      // 石化当前选择
-      curSinopecIdx: 0
+      petrifactionCard: '',
+      // 充值面额
+      oil_amount: [],
+      // 当前面额
+      curAmountIdx: null,
+      curAmount: ''
     }
   },
   created() {
@@ -120,10 +113,14 @@ export default {
       let res = await Http.getInstance().getDenomination();
       console.log('油卡面额', res);
       if (res && res.msg == '请求成功') {
-        this.petrochina = res.data.petrochina
-        this.sinopec = res.data.sinopec
+        this.oil_amount = res.data.oil_amount
       }
     },
+    // 选择石化充值面额
+    hPetrifaction(idx, item) {
+      this.curAmountIdx = idx
+      this.curAmount = item
+    },
     // 充值按钮
     recharfeBtn() {}
   }
@@ -204,7 +201,7 @@ export default {
     background-color: #fff;
   }
   /deep/.el-tabs--border-card>.el-tabs__content {
-    height: 30rem;
+    height: 13rem;
   }
   /deep/.el-tabs--border-card>.el-tabs__content {
     padding: 15px 20px;
@@ -236,6 +233,13 @@ export default {
       }
     }
   }
+  .denomination {
+    width: 100%;
+    margin-top: 1.667rem;
+    background-color: #fff;
+    border-radius: 1.667rem;
+    padding: 15px 20px;
+  }
   .denominationCard {
     // width: 7.917rem;
     width: 29.3%;

+ 295 - 4
src/views/index/phoneRecharge.vue

@@ -1,13 +1,304 @@
 <template>
-  <div class="phoneRecharge">政策解读</div>
+  <div class="phoneRecharge">
+    <div class="p_head">
+      <img src="../../assets/image/payrollback_left@2x.png" class="leftIcon" alt="" @click="$router.replace('/index')">
+      <span>
+          <span>
+              手机充值
+          </span>
+      </span>
+    </div>
+    <div class="phoneCard">
+      <!-- 选择手机卡 -->
+      <div class="cardContent">
+        <div class="selectCard">选择手机号</div>
+        <el-input v-model="phoneCard" placeholder="请输入12位手机号码" />
+        <div class="alert">
+          <img src="@/assets/image/cardAlert@2x.png" alt="">
+          <span>请仔细核对手机号,避免造成不必要的损失。</span>
+        </div>
+      </div>
+      <!-- 充值面额 -->
+      <div class="denomination">
+        <div style="font-family: PingFang SC;color:#333;">充值面额</div>
+        <div>
+          <div
+            class="denominationCard"
+            :class="{'activeBorder': idx == curAmountIdx}"
+            v-for="(item, idx) in phone_amount" :key="item"
+            @click="hPetrifaction(idx, item)">
+            <span>{{item}}</span>
+            <i>优惠价{{item * 0.995}}元</i>
+            <div :class="{'active': idx == curAmountIdx}"></div>
+          </div>
+        </div>
+      </div>
+      <div class="recharfeBtn" @click="recharfeBtn">
+        <img src="@/assets/image/rechargeBtn@2x.png" alt="">
+      </div>
+      <!-- 说明 -->
+      <div class="explain">
+        <div class="explainHead">
+          <i></i>
+          <span>充值说明</span>
+          <i></i>
+        </div>
+        <ol>
+          <li>1. 充值优惠来自充值平台补贴;</li>
+          <li>2. 充值后1-10分钟左右到账,运营商将发充值成功短信至充值 手机;</li>
+          <li>3. 如需开发票请至相应的手机运营商官方APP开取电子发票;</li>
+        </ol>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
+import Http from '@/extend/Http';
 export default {
-
+  name: 'phoneRecharge',
+  data() {
+    return {
+      // 手机号
+      phoneCard: '',
+      // 充值面额
+      phone_amount: [],
+      curAmountIdx: null,
+      // 当前面额
+      curAmount: ''
+    }
+  },
+  created() {
+    this.getDenomination()
+  },
+  watch: {
+    '$route': {
+      handler(newVal) {
+        if (newVal.path == '/phoneRecharge' && !localStorage.getItem('access_token')) {
+            router.replace('/login')
+        }
+      }
+    }
+  },
+  methods: {
+    handleClick(tab, event) {
+      // console.log(tab, event);
+    },
+    // 获取充值面额
+    async getDenomination() {
+      let res = await Http.getInstance().getDenomination();
+      console.log('手机面额', res);
+      if (res && res.msg == '请求成功') {
+        this.phone_amount = res.data.phone_amount
+      }
+    },
+    // 选择石化充值面额
+    hPetrifaction(idx, item) {
+      this.curAmountIdx = idx
+      this.curAmount = item
+    },
+    // 充值按钮
+    recharfeBtn() {}
+  }
 }
 </script>
 
-<style>
-
+<style lang="scss" scoped>
+  .phoneRecharge {
+    background-color: #EDF0F5;
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    box-sizing: border-box;
+    overflow: auto;
+  }
+  // 顶部导航
+  .p_head{
+    text-align: center;
+    position: relative;
+    top: 1.5rem;
+    font-size: 2rem;
+    // font-family: 'PingFang SC';
+    margin-bottom: 3.667rem;
+    // font-weight: bold;
+    line-height: 1.5rem;
+    .leftIcon{
+      position: absolute;
+      left: 1.667rem;
+      top: 0.7rem;
+      width: 0.667rem;
+    }
+    span {
+      vertical-align: middle;
+    }
+  }
+  .phoneCard {
+    padding: 0 1.667rem 7.5rem;
+  }
+  .cardContent {
+    height: 13rem;
+    background-color: #fff;
+    padding: 15px 20px;
+    font-size: 1.167rem; 
+    border-radius: 1.667rem;
+    font-family: PingFang SC;
+    color: #333;
+    .selectCard {
+      margin-bottom: 1.667rem;
+    }
+    /deep/.el-input__inner {
+      border: 0;
+      border-bottom: 1px solid #BFBFBF;
+      border-radius: 0;
+      // margin-bottom: 1rem;
+      padding-left: 0;
+    }
+    .alert {
+      font-size: 1.2rem;
+      color: #F58520;
+      padding-left: 0;
+      padding-right: 0;
+      img {
+        width: 1.2rem;
+        margin-right: 0.6rem;
+      }
+      span {
+        vertical-align: middle;
+      }
+    }
+  }
+  .denomination {
+    width: 100%;
+    margin-top: 1.667rem;
+    background-color: #fff;
+    border-radius: 1.667rem;
+    padding: 15px 20px;
+  }
+  .denominationCard {
+    // width: 7.917rem;
+    width: 29.3%;
+    height: 5rem;
+    border: 1px solid #E5E5E5;
+    margin-right: 1.667rem;
+    margin-top: 1.667rem;
+    display: inline-block;
+    // padding-left: 1rem;
+    position: relative;
+    span {
+      display: block;
+      font-size: 1.167rem;
+      font-family: PingFang SC;
+      font-weight: bold;
+      color: #F58520;
+      margin-top: 0.5rem;
+      margin-bottom: 0.3rem;
+      text-align: center;
+    }
+    i {
+      display: block;
+      text-align: center;
+      font-style: normal;
+      font-size: 1rem;
+      font-family: PingFang SC;
+      font-weight: 500;
+      color: #666666;
+    }
+  }
+  .denominationCard.activeBorder {
+    border: 2px solid #F58520;
+  }
+  .denominationCard:nth-child(3n) {
+    margin-right: 0;
+  }
+  .active {
+    background-color: #F58520;
+    -moz-opacity: 0.2;
+    opacity:.20;
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+  }
+  .recharfeBtn {
+    margin: 2.5rem 0;
+    img {
+      width: 100%;
+    }
+  }
+  .explainHead {
+    padding: 0 4.667rem;
+    margin-bottom: 2.083rem;
+    i {
+      display: inline-block;
+      font-style: normal;
+      width: 6rem;
+      height: 1px;
+      background-color: #999;
+      vertical-align: middle;
+    }
+    span {
+      display: inline-block;
+      font-size: 1.5rem;
+      font-family: PingFang SC;
+      font-weight: 500;
+      color: #666666;
+      margin: 0 1.25rem;
+    }
+  }
+  ol li {
+    font-size: 1.1rem;
+    font-family: PingFang SC;
+    font-weight: 500;
+    color: #666666;
+    margin-bottom: 1.667rem;
+  }
+  @media screen and (max-width: 375px) {
+    .cardContent .alert {
+      font-size: 1.1rem;
+    }
+    .denominationCard {
+      margin-right: 1.3rem;
+    }
+    .explainHead i {
+      width: 5rem;
+    }
+  }
+  @media screen and (max-width: 360px) {
+    .cardContent .alert {
+      font-size: 1.1rem;
+    }
+    .denominationCard {
+      margin-right: 1.3rem;
+    }
+    .explainHead i {
+      width: 4rem;
+    }
+  }
+  @media screen and (max-width: 320px) {
+    .cardContent .alert {
+      font-size: 1rem;
+    }
+    .denominationCard {
+      width: 41.3%;
+      margin-right: 1.3rem;
+    }
+    .explainHead i {
+      width: 2.5rem;
+    }
+    /deep/#tab-petrifaction,
+    /deep/#tab-petroleum {
+      padding-left: 2rem;
+      padding-right: 0;
+    }
+    .cardContent .el-input__inner {
+      font-size: 1rem;
+    }
+    .denominationCard:nth-child(2n) {
+      margin-right: 0;
+    }
+    .denominationCard:nth-child(3n) {
+      margin-right: 1.667rem;
+    }
+  }
 </style>

+ 258 - 3
src/views/recharge/list.vue

@@ -1,15 +1,270 @@
 <template>
   <div class="rechargeList">
-    充值列表
+    <div class="user_head">
+      <img src="../../assets/image/payrollback_left@2x.png" class="leftIcon" alt="" @click="$router.replace('/user')">
+      <span>
+        充值订单
+      </span>
+    </div>
+    <div class="list">
+      <el-tabs class="haoyou" @tab-click="handleClick">
+        <el-tab-pane label="待支付">
+          <ul class="list-group list-group-flush" v-if="!cueShow" style="line-heigt:1.5rem">
+            <li class="list-group-item m-2 mb-0" v-for="(item, idx) in list" :key="idx" >
+              <div class="section">
+                  <p class="d-flex align-items-center">
+                    <span class="leftColor">订单编号</span>
+                    <span class="ml-auto rightColor"></span>
+                  </p>
+                  <p class="d-flex align-items-center">
+                      <span class="leftColor">下单时间</span>
+                      <span class="ml-auto rightColor"></span>
+                  </p>
+              </div>
+              <div class="section">
+                  <p class="d-flex align-items-center">
+                      <span class="leftColor">办理进度</span>
+                      <span class="ml-auto" style="color:#fb2e2e"></span>
+                  </p>
+                  <p class="d-flex align-items-center">
+                      <span class="leftColor">实付金额</span>
+                      <span class="ml-auto leftColor">&yen;</span>
+                  </p>
+              </div>
+              <div class="footer  align-items-center" style="justify-content: space-between;">
+                  <button class="btn btn-info" style="background: #4FDCA2;border:1px solid #4FDCA2" @click="open">联系我们</button>
+                  <button class="btn btn-info" style="background: #fff;color:#666666;border:1px solid rgb(102, 102, 102,.5)"  @click="cancel">取消订单</button>
+                  <a class="btn btn-info"  style="background: #fff;color:#666666;border:1px solid rgb(102, 102, 102,.5)">订单详情</a>
+                  <button style="background: #F78F7E;border:1px solid #F78F7E" class="btn btn-info" @click="gopay">去付款</button>
+              </div>
+            </li>
+          </ul>
+            <div class="cuewords">
+                <p>您暂时还没有订单</p>
+            </div>
+        </el-tab-pane>
+      </el-tabs>
+      <div class="more" v-if="moreShow">
+        <a href="javascript:void(0);" class="btn btn-light btn-block m-2 pt-3 pb-3" v-on:click="loadMore"
+          v-if="hasMore">点击加载更多</a>
+        <p class="text-center" style="color:#999" v-if="!hasMore">没有更多了</p>
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
+import Http from "../../extend/Http";
 export default {
-
+  name: 'rechargeList',
+  data() {
+    return {
+      list: [],
+      status: 0,
+      cueShow: false,
+      cueShow2: false,
+      cueShow3: false,
+      moreShow: false,
+      hasMore: true,
+      page: 1
+    }
+  },
+  created() {
+    this.getRechargeLists()
+  },
+  methods: {
+    async getRechargeLists () {
+      let res = await Http.getInstance().getRechargeLists({
+        page: this.page,
+        order_state: this.status
+      });
+      console.log('充值订单', res);
+      if(res.data.length == 0){
+        this.cueShow = true
+        this.cueShow2 = true
+        this.cueShow3 = true
+        this.moreShow = false
+      }else{
+        this.list = res.data
+        this.hasMore = res.data.length >9 ;
+        this.moreShow = true
+      }
+    },
+    handleClick(tab,event){
+      if(tab.label == '待支付'){
+      }
+    },
+    open() {
+      // @ts-ignore
+      MessageBox.alert('<a href="tel:' + Http.PHONE + '">' + Http.PHONE  + '</a><p>手机号同步微信</p>', '请联系客服', {
+        dangerouslyUseHTMLString: true,
+        confirmButtonText: "拨打" ,
+      }).then(action =>{
+        window.location.href = 'tel://' +Http.PHONE;
+      });
+    },
+    async loadMore() {
+      let res = await Http.getInstance().getRechargeLists({
+        page: this.page,
+        status: this.status
+      });
+      this.hasMore = res.data.length >9 ;
+      this.list = [].concat(this.list.concat(res.data));
+      this.page++;
+    },
+    // 取消订单
+    cancel() {},
+    // 付款
+    gopay() {}
+  }
 }
 </script>
 
-<style>
+<style lang="scss" scoped>
+// 顶部导航
+.user_head{
+    text-align: center;
+    font-size: 2rem;
+    // font-family: 'PingFang SC';
+    padding-bottom: 1.667rem;
+    padding-top: 1rem;
+    // font-weight: bold;
+    line-height: 1.5rem;
+    background-color: #fff;
+    .leftIcon{
+        position: absolute;
+        left: 1.667rem;
+        top: 1.4rem;
+        width: 0.667rem;
+    }
+    span {
+        vertical-align: middle;
+        color: #333;
+    }
+}
+ .list {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+    background-color: #EDF0F5;
+}
+// tab栏样式
+.list /deep/.el-tabs__active-bar {
+    background-color: #4FDCA2;
+}
+.list /deep/.el-tabs__item.is-active {
+    color: #333;
+}
+.list /deep/.el-tabs__item {
+    color: #666;
+    font-size: 1.4rem;
+}
+.list /deep/.el-tabs__nav-wrap {
+    background-color: #fff;
+}
+.list /deep/.el-tabs__header {
+    width: 100%;
+    display: flex;
+    justify-content: space-around;
+    margin: 0;
+    background-color: #fff;
+}
+.list /deep/.el-tabs__nav-wrap::after {
+    background: none;
+}
+// 右侧字体颜色
+.rightColor {
+    color: #666;
+}
+.leftColor {
+    color: #333;
+}
+.list-wrap {
+}
+.haoyou{
+  .el-tabs__nav-scroll{
+      /*margin-left: 9rem;*/
+      // padding: 0 8rem;
+      width: 100%;
+      display: flex;
+      justify-content: space-around;
+  }
+}
+// 内边距
+    .list-group {
+        padding: 1rem;
+    }
+    .list .list-group-item {
+        border-radius: 0.833rem;
+        // padding: .5rem;
+        padding: 1rem 1rem 1.5rem 1rem;
+        margin: .5rem;
+        margin-bottom: 0;
+        background: #fff;
+    }
 
+.footer {
+    color: #ffffff;
+    // float: right;
+    width: 100%;
+    display: flex;
+    padding-top: 1rem;
+    .btn {
+        padding: 0.375rem 0.55rem;
+    }
+    .btn-info{
+        // margin: 0 0.5rem;
+        border: none;
+        // border-radius: 1.5rem;
+        border-radius: 0.5rem;
+        font-size: 1rem;
+    }
+    .btnLeft {
+        margin-right: 1rem;
+    }
+}
+.footer:first-child {
+    width: 100%;
+    display: flex;
+    justify-content: space-around;
+}
+.cuewords{
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    font-size: 1.2rem;
+    p{
+        margin-top: 9rem;
+        color: #999
+    }
+}
+.section{
+    position: relative;
+}
+.seal-img{
+    position: absolute;
+    // top: 0;
+    // right: 5rem;
+    // width: 5rem;
+    top: -6.5rem;
+    height: 6rem;
+    right: 0rem;
+    width: 6rem;
+    background: url("../../assets/image/seal_03@2px.png") no-repeat;
+    background-size: 100%;
+    // padding-top: 1.7rem;
+    // padding-left: 0.9rem;
+    padding-top: 2.25rem;
+    padding-left: 1.4rem;
+    span{
+        // color: #ee1e1e;
+        color: #fff;
+        font-size: 1rem;
+        display: inline-block;
+        // transform:rotate(-31deg);
+        transform:rotate(-11deg);
+        font-weight:700 ;
+        text-align: center;
+    }
+}
 </style>