zizhong.wang před 2 roky
rodič
revize
81d92ac9bc
4 změnil soubory, kde provedl 118 přidání a 99 odebrání
  1. 19 0
      App.vue
  2. 4 27
      pages/heatingPage/list.vue
  3. 87 45
      pages/heatingPage/pay.vue
  4. 8 27
      pages/index/index.vue

+ 19 - 0
App.vue

@@ -22,6 +22,19 @@ export default {
 	company_logo:'',
 	isAndroid:false,
 	nowTime:'',
+	
+	statusObj:{
+			  '0':'未缴费',
+			  '1':'已缴费',
+			  '2':'空置已缴费',
+			  '3':'空置转全额'
+	},
+	statusColor:{
+			  '0':'#D9001B',
+			  '1':'#70B603',
+			  '2':'#4B7902',
+			  '3':'#BFBF00',
+	}
   },
   onLaunch: function () {
     console.log("App Launch");
@@ -71,6 +84,12 @@ export default {
 	  		}
 	  	})
 	  },
+	  makeApiUrl(method,source,action){
+		  let timestamp = Date.now().toString();
+		  let md5Sign = md5("method="+method+"&timestamp="+timestamp+"&secret="+getApp().globalData.secret);
+		  let url = getApp().globalData.shareUrl+'api/api.php'+'?method='+method+'&source='+source+'&action='+action+'&timestamp='+timestamp +'&sign='+md5Sign;
+		  return url;
+	  },
 	  loginRequest(codeRes){
 	  	let md5Sign = md5("method="+'user'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
 	  	let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&source=user&action=login&timestamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign

+ 4 - 27
pages/heatingPage/list.vue

@@ -52,18 +52,8 @@ export default {
       message: "缴费订单",
       themeColor: "#007AFF",
       heatList: [],
-	  statusObj:{
-		  '0':'未缴费',
-		  '1':'已缴费',
-		  '2':'空置已缴费',
-		  '3':'空置转全额'
-	  },
-	  statusColor:{
-		  '0':'#D9001B',
-		  '1':'#70B603',
-		  '2':'#4B7902',
-		  '3':'#BFBF00',
-	  }
+	  statusObj:getApp().globalData.statusObj,
+	  statusColor:getApp().globalData.statusColor,
     };
   },
   onLoad() {
@@ -76,21 +66,8 @@ export default {
       });
     },
     getHeatList() {
-      let md5Sign = md5(
-        "method=" +
-          "user" +
-          "&timestamp=" +
-          getApp().globalData.globalTimestamp +
-          "&secret=" +
-          getApp().globalData.secret
-      );
-      let url =
-        getApp().globalData.shareUrl +
-        "api/api.php" +
-        "?method=user&source=user&action=get_order_list&timestamp=" +
-        getApp().globalData.globalTimestamp +
-        "&sign=" +
-        md5Sign;
+      
+	  let url = getApp().makeApiUrl("user",'user','get_order_list');
       let postData = {
         // page: 1,
         // page_size: 2,

+ 87 - 45
pages/heatingPage/pay.vue

@@ -24,16 +24,34 @@
 	  <view class="tel flex">
 	    <label>缴费类型:</label>
 		<radio-group  @change="payChange">
-		  <radio value="1" :checked="payInfo.type!==2" style="margin-right: 30rpx;transform: scale(0.85);">金额</radio>
-		  <radio value="2" :checked="payInfo.type===2" style="transform: scale(0.85);">空置</radio>
+		  <radio value="1" :checked="payInfo.type!=2" style="margin-right: 30rpx;transform: scale(0.85);">金额</radio>
+		  <radio value="2" :checked="payInfo.type==2" style="transform: scale(0.85);">空置</radio>
 		</radio-group>
 	  </view>
 	  <view class="tel flex">
 	    <label>缴费金额:</label>
 	    <input type="text" class="card input" id="real_fee" v-model="payInfo.real_fee" disabled/>
-	  </view>			
+	  </view>
+	   <view class="tel flex">
+	     <label>订单状态:</label>
+	     <input type="text" class="card input" id="status" :style="{color:statusColor[payInfo.status]}" v-model="statusObj[payInfo.status]"  disabled/>
+	   </view>
+	   <view class="tel flex" v-if="payInfo.invoice_status > 0">
+	     <label>发票抬头:</label>
+	     <input type="text" class="card input" id="real_fee" v-model="payInfo.invoice" disabled/>
+	   </view>
+	   <view class="tel flex" v-if="payInfo.invoice_status > 0">
+	     <label>发票备注:</label>
+	     <input type="text" class="card input" id="real_fee" v-model="payInfo.invoice_remark" disabled/>
+	   </view>
+	   <view class="tel flex" v-if="payInfo.invoice_status > 0">
+	     <label>发票状态:</label>
+	     <input type="text" class="card input" id="real_fee" v-model="invoiceStatusStr" disabled/>
+	   </view>
+			
     </view>
-    <button class="submit" @tap="paySubmit">{{payStatus ? '申请开票' : '缴费'}}</button>
+    <button class="submit" style="margin-bottom:20rpx" @tap="paySubmit" v-if="needPay">{{payStatusStr}}</button>
+	<button class="submit" style="margin-top:20rpx" @tap="openPopup" v-if="needInvoice">申请开票</button>
 	<uni-popup ref="popup" :mask-click="false">
 		  <view class="popup-box">
 			  <view>
@@ -41,10 +59,10 @@
 				  <view class="popup-content-box">
 				  		  <view class="popup-content">
 				  			  <view class="popup-type">
-				  			  	  <view>开票抬头:</view><input type="text" value="" />
+				  			  	  <view>开票抬头:</view><input type="text" v-model="invoiceName" />
 				  			  </view>
 				  			  <view class="popup-type">
-				  			  	  <view>备注:</view><input type="text" value="" />
+				  			  	  <view>备注:</view><input type="text" v-model="invoiceRemark" />
 				  			  </view>
 				  		  </view>
 				  </view>
@@ -64,7 +82,15 @@ export default {
       payInfo: {
       },
 	  payStatus:0,
+	  payStatusStr : '缴费',
+	  needPay : 1,
+	  needInvoice : 0,
+	  invoiceStatusStr : "待开票",
 	  pay_code : '',
+	  statusObj:getApp().globalData.statusObj,
+	  statusColor:getApp().globalData.statusColor,
+	  invoiceName : '',
+	  invoiceRemark : '',
     };
   },
   onLoad(option) {
@@ -73,21 +99,8 @@ export default {
   },
   methods: {   
     getPayDetail(payId) {
-      let md5Sign = md5(
-        "method=" +
-          "user" +
-          "&timestamp=" +
-          getApp().globalData.globalTimestamp +
-          "&secret=" +
-          getApp().globalData.secret
-      );
-      let url =
-        getApp().globalData.shareUrl +
-        "api/api.php" +
-        "?method=user&source=user&action=get_order_info&timestamp=" +
-        getApp().globalData.globalTimestamp +
-        "&sign=" +
-        md5Sign;
+     
+	  let url = getApp().makeApiUrl("user",'user','get_order_info');
       let postData = {
         code:payId,
         openId: getApp().globalData.open_id,
@@ -102,7 +115,19 @@ export default {
         success: (res) => {
           if (res.data.code === 200) {
                this.payInfo = res.data.data;
-			   this.payInfo.address = this.payInfo.estate_name  + this.payInfo.building_name + this.payInfo.unit + this.payInfo.room
+			   this.payInfo.address = this.payInfo.estate_name  + this.payInfo.building_name + this.payInfo.unit + this.payInfo.room;
+			   if (this.payInfo.status > 0 && this.payInfo.invoice_status == 0){
+				   this.needInvoice = 1;
+			   }
+			   if (this.payInfo.status == 2){
+				   this.payStatusStr = '补充缴费';
+			   }
+			   if (this.payInfo.status == 1 || this.payInfo.status == 3){
+				   this.needPay = 0;
+			   }
+			   if (this.payInfo.invoice_status == 2){
+				   this.invoiceStatusStr = "已开票";
+			   }
           } else {
             uni.showToast({
               title: res.data.msg,
@@ -131,26 +156,8 @@ export default {
 		this.payInfo.type = e.detail.value;
 	},
 	paySubmit(){
-		if(this.payStatus){
-			this.open()
-			return
-		}
 		
-		let md5Sign = md5(
-		  "method=" +
-		    "user" +
-		    "&timestamp=" +
-		    getApp().globalData.globalTimestamp +
-		    "&secret=" +
-		    getApp().globalData.secret
-		);
-		let url =
-		  getApp().globalData.shareUrl +
-		  "api/api.php" +
-		  "?method=user&source=user&action=prepay&timestamp=" +
-		  getApp().globalData.globalTimestamp +
-		  "&sign=" +
-		  md5Sign;
+		let url = getApp().makeApiUrl("user",'user','prepay');
 		let postData = {
 		  code:this.pay_code,
 		  type : this.payInfo.type,
@@ -202,13 +209,48 @@ export default {
 			
 	},
 	submitInvocie(){
-		this.closePopup()
+		
+		this.closePopup();
+		
 	},
-	open() {
-		  this.$refs.popup.open('center')
+	openPopup() {
+		  this.$refs.popup.open('center');
 	  },
 	closePopup() {
-		  this.$refs.popup.close()
+		  this.$refs.popup.close();
+		  let url = getApp().makeApiUrl("user",'user','invoice');
+		  let postData = {
+		    code:this.pay_code,
+			invoice : this.invoiceName,
+			remark : this.invoiceRemark,
+		    openId: getApp().globalData.open_id,
+		  };
+		  uni.request({
+		    url: url,
+		    method: "POST",
+		    header: {
+		      "content-type": "application/x-www-form-urlencoded",
+		    },
+		    data: postData,
+		    success: (res) => {
+		      if (res.data.code === 200) {
+		           uni.showToast({
+		             title: res.data.msg,
+		             icon: "none",
+		             duration: 2500,
+		           });
+		      } else {
+		        uni.showToast({
+		          title: res.data.msg,
+		          icon: "none",
+		          duration: 2500,
+		        });
+		      }
+		    },
+		    fail: () => {
+		      console.log("连接失败");
+		    },
+		  });
 	  },	
   },
 };

+ 8 - 27
pages/index/index.vue

@@ -139,18 +139,8 @@ export default {
         },
       ],
       heatList: [],
-	  statusObj:{
-		  '0':'未缴费',
-		  '1':'已缴费',
-		  '2':'空置已缴费',
-		  '3':'空置转全额'
-	  },
-	  statusColor:{
-		  '0':'#D9001B',
-		  '1':'#70B603',
-		  '2':'#4B7902',
-		  '3':'#BFBF00',
-	  }
+	  statusObj:getApp().globalData.statusObj,
+	  statusColor:getApp().globalData.statusColor,
     };
   },
   onShow() {
@@ -182,6 +172,7 @@ export default {
 		})
 	},
     getSwiperList() {
+		
       let md5Sign = md5(
         "method=" +
           "common" +
@@ -197,6 +188,8 @@ export default {
         getApp().globalData.globalTimestamp +
         "&sign=" +
         md5Sign;
+		
+	   
       uni.request({
         url: url,
         method: "POST",
@@ -225,26 +218,14 @@ export default {
       });
     },
     getHeatList() {
-      let md5Sign = md5(
-        "method=" +
-          "user" +
-          "&timestamp=" +
-          getApp().globalData.globalTimestamp +
-          "&secret=" +
-          getApp().globalData.secret
-      );
-      let url =
-        getApp().globalData.shareUrl +
-        "api/api.php" +
-        "?method=user&source=user&action=get_order_list&timestamp=" +
-        getApp().globalData.globalTimestamp +
-        "&sign=" +
-        md5Sign;
+
+	  let url = getApp().makeApiUrl("user",'user','get_order_list');
       let postData = {
         // page: 1,
         // page_size: 2,
 		openId:getApp().globalData.open_id ? getApp().globalData.open_id : uni.getStorageSync('openId')
       };
+	  
       uni.request({
         url: url,
         method: "POST",