Quellcode durchsuchen

我的套餐及套餐详情对接

1004749546@qq.com vor 4 Jahren
Ursprung
Commit
3598bfa19a
4 geänderte Dateien mit 198 neuen und 131 gelöschten Zeilen
  1. 32 0
      src/api/packageRequest.js
  2. 5 5
      src/api/request.js
  3. 67 56
      src/pages/myPackage/index.vue
  4. 94 70
      src/pages/packageDetail/index.vue

+ 32 - 0
src/api/packageRequest.js

@@ -0,0 +1,32 @@
+import request from './request';
+
+// 获取套餐列表
+export const getPackageList = params => {
+  return request({
+    url: 'customerBundle/findList',
+    data: params,
+    method: 'post',
+    isQbcgj: true,
+    useCgjToken: true, // 使用车管家token
+  }).then(res => res.data);
+};
+
+// 获取套餐使用明细
+export const getPackageDetail = params => {
+  return request({
+    url: 'customerBundle/findCustBundleOrder',
+    data: params,
+    method: 'post',
+    isQbcgj: true,
+    useCgjToken: true, // 使用车管家token
+  }).then(res => res.data);
+};
+// 丘比养车登录车管家,获取接口凭证
+export const getQbcgjLogin = params => {
+  return request({
+    url: 'zyycLoginVerify',
+    data: params,
+    method: 'post',
+    isQbcgj: true,
+  }).then(res => res.data);
+};

+ 5 - 5
src/api/request.js

@@ -7,14 +7,14 @@ function request(options) {
   // });
   return new Promise((resolve, reject) => {
     // 丘比养车服务
-    const baseycUrl = 'https://zyyc.chelingzhu.com/zyyc-shop/'; // 预发布
+    // const baseycUrl = 'https://zyyc.chelingzhu.com/zyyc-shop/'; // 预发布
     // const baseycUrl = 'https://shop.qiubcar.com/zyyc-shop/'; // 生产
-    // const baseycUrl = 'http://192.168.16.103:7101/zyyc-shop/';
+    const baseycUrl = 'http://192.168.16.103:7101/zyyc-shop/';
     // const baseycUrl = process.env.NODE_ENV === 'production' ? proUrl : devUrl;
     // 丘比车管家服务
-    const qbcgjUrl = 'http://md.test.zyucgj.com/saas/clz/'; // 预发布
+    // const qbcgjUrl = 'http://md.test.zyucgj.com/saas/clz/'; // 预发布
     // const qbcgjUrl = 'https://md.qiubcar.com/saas/clz/'; // 生产
-    // const qbcgjUrl = 'http://192.168.16.102:9110/saas/clz/';
+    const qbcgjUrl = 'http://192.168.16.103:7003/clzwx/';
     let _obj = {
       url: '',
       data: {},
@@ -25,7 +25,7 @@ function request(options) {
     };
 
     Object.assign(_obj, options);
-    _obj.header['X-AUTH-TOKEN'] = mpvue.getStorageSync('token');
+    _obj.header['X-AUTH-TOKEN'] = options.useCgjToken ? mpvue.getStorageSync('token_cgj') : mpvue.getStorageSync('token');
     _obj.header['X-HEADER-APPID'] = 'qaHKg54DXewQ496T5XR+w9UEf9vNaJoAoTOtDN0LSUM=';
     _obj.url = (options.isQbcgj ? qbcgjUrl : baseycUrl) + _obj.url;
     _obj.method = _obj.method.toUpperCase();

+ 67 - 56
src/pages/myPackage/index.vue

@@ -1,16 +1,12 @@
 <template>
     <view class="content">
-      <!-- loading -->
-      <view class="load" v-if="isLoading">
-        <van-loading type="spinner" color="#1989fa">加载中...</van-loading>
-      </view>
       <scroll-view scroll-y>
         <van-collapse :value="activeNames" @change="onChange">
-            <van-collapse-item v-for="(item,index) in dataList" :key="index" :title="item.bundleName" :name="index">
+            <van-collapse-item style="margin-bottom: 10px;" v-for="(item,index) in dataList" :key="index" :title="item.bundleName" :name="index">
         				<template v-if="item.customerBundleItemList">
         				      <view class="item-title">
         				      	<view class="list-item-left ">
-        				       		<text style="font-size: 30rpx;font-weight: 600;">服务</text>
+        				       		<text style="font-size: 30rpx;">服务</text>
         				      	</view>
 
         				      </view>
@@ -23,12 +19,10 @@
         				      	    </view>
         				      	</view>
         				 </template>
-
-
         				<template v-if="item.customerBundlePartList">
         					<view class="item-title ">
         						<view class="list-item-left">
-        					 		<text style="font-size: 30rpx;font-weight: 600;">配件</text>
+        					 		<text style="font-size: 30rpx;">配件</text>
         						</view>
 
         					</view>
@@ -50,64 +44,73 @@
         			   </view>
             </van-collapse-item>
         </van-collapse>
+        <no-data :options="dataList" name="暂无套餐"/>
       </scroll-view>
-		<view  v-if="isLoading && dataList.length ==0 " class="no-data">
-			暂无数据
-		</view>
-
     </view>
 </template>
 
 <script>
+  import {getQbcgjLogin,getPackageList} from '@/api/packageRequest.js'
+  import NoData from '@/components/NoData';
     export default {
         components: {
+          'no-data': NoData
         },
         data() {
             return {
             activeNames: [],
-            dataList:[{
-              bundleName: 'ceshijh',
-              id: 1,
-              customerBundleItemList: [
-                {
-                  itemName: '111',
-                  itemTimes: 1
-                },
-              ],
-              customerBundlePartList: [
-                {
-                  partName: '111',
-                  quantity: 1
-                },
-               {
-                 partName: '111',
-                 quantity: 1
-               },
-              ]
-            },{
-              bundleName: 'ceshijh',
-              id: 1,
-              customerBundleItemList: [
-                {
-                  itemName: '111',
-                  itemTimes: 1
-                },
-              ],
-              customerBundlePartList: [
-                {
-                  partName: '111',
-                  quantity: 1
-                },
-               {
-                 partName: '111',
-                 quantity: 1
-               },
-              ]
-            }],
+            dataList:[],
             isLoading:false , //判断页面数据是否请求完全
           }
         },
         methods: {
+         RondomPass(number){
+              var arr = new Array;
+              var arr1 = new Array("0","1","2","3","4","5","6","7","8","9");
+              var nonceStr=''
+              for(var i=0;i<number;i++){
+                  var n = Math.floor(Math.random()*10);
+                  arr[i] =arr1[n] ;
+                  nonceStr+=arr1[n];
+              }
+              return nonceStr
+          },
+          // 丘比养车登录车管家,获取接口凭证
+          getCgjLogin() {
+            let mobile = wx.getStorageSync('phone')
+            let randCode = this.RondomPass(10)
+            console.log(randCode,'randCode')
+            getQbcgjLogin({mobile:mobile,randCode:randCode}).then(res=>{
+              console.log(res,'rrrrrrr')
+              if (res.status === '200') {
+                mpvue.setStorage('token_cgj',res.data.token)
+                this.getPackageData()
+              } else {
+                wx.showToast({
+                  title: res.message,
+                  icon: 'none',
+                  duration: 2500
+                });
+              }
+            })
+          },
+          // 获取套餐列表
+          getPackageData() {
+            getPackageList({}).then(res => {
+              wx.hideLoading()
+              if (res.status === '200') {
+                this.dataList = res.data
+              } else {
+                wx.showToast({
+                  title: res.message,
+                  icon: 'none',
+                  duration: 2500
+                });
+              }
+              this.isLoading = true
+              wx.hideLoading();
+            });
+          },
           // 进入套餐详情
           intoDetail(item) {
             wx.navigateTo({
@@ -121,7 +124,13 @@
           }
         },
         onLoad() {
-
+          wx.showLoading({
+            mask: true,
+            title: '加载中'
+          })
+          this.isLoading = false
+          this.activeNames = []
+          this.getCgjLogin()
         },
         onReady() {
 
@@ -129,7 +138,7 @@
     }
 </script>
 
-<style lang="stylus" scoped>
+<style lang="stylus" >
 	.content{
     padding: 15rpx 40rpx;
     font-size : 14px;
@@ -166,6 +175,9 @@
 			-webkit-transform: scaleY(0.5);
 			transform: scaleY(0.5);
 	}
+  van-collapse-item{
+    margin-bottom: 10px !important;
+  }
   .van-collapse-cell--open{
   	background: #FFFFFF;
   }
@@ -199,7 +211,7 @@
   		align-items: center;
   		justify-content: center;
   		font-size: 28rpx;
-  		color: grb(74,74,74);
+  		color: rgb(40,40,40);
   }
   .show-detail image{
   	width: 18rpx;
@@ -219,7 +231,6 @@
   	width: 100%;
   	height: 60rpx;
   	line-height: 60rpx;
-  	font-weight:600;
     color: rgb(40,40,40);
   }
   .border-bottom-solid{

+ 94 - 70
src/pages/packageDetail/index.vue

@@ -4,83 +4,84 @@
        	{{bundleName}}
        </view>
 		<view class="list-container">
-
-			<template v-if="packageData.orderItemList">
-				<view  class="list-item-title border-bottom-solid">
-						<view class="list-item-cont">
-							<view class="name">
-								<text >服务名称</text>
-							</view>
-
-							<view class="num">
-								<text >使用次数</text>
-							</view>
-							<view class="time">
-								<text >使用时间</text>
-							</view>
-						</view>
-
-				</view>
-
-				<view class="list-item " v-for="(item,index) in packageData.orderItemList" :key="index">
-					<view class="list-item-cont" :class="index != (packageData.orderItemList.length-1) ?'border-bottom-dashed':'' ">
-						<view class="name">
-							<text>{{item.itemName}}</text>
-						</view>
-						<view class="num">
-							<text >{{item.time}}次</text>
-						</view>
-						<text class="time">{{item.orderDate}}</text>
-					</view>
-
-				</view>
-				<!-- 分割区域 -->
-				<view v-if="packageData.orderPartList" class="list-br">
-
-				</view>
-			</template>
-
-			<template v-if="packageData.orderPartList">
-				<view  class="list-item-title border-bottom-solid">
-						<view class="list-item-cont">
-							<view class="name">
-								<text >配件名称</text>
-							</view>
-
-							<view class="num">
-								<text >使用数量</text>
-							</view>
-							<view class="time">
-								<text >使用时间</text>
-							</view>
-						</view>
-
-				</view>
-
-				<view class="list-item " v-for="(item,index) in packageData.orderPartList" :key="index">
-					<view class="list-item-cont " :class="index != (packageData.orderPartList.length-1) ?'border-bottom-dashed':'' ">
-						<view class="name">
-							<text>{{item.partName}}</text>
-						</view>
-						<view class="num">
-							<text >{{item.quantity}} {{item.unit?item.unit:''}}</text>
-						</view>
-						<text class="time">{{item.orderDate}}</text>
-					</view>
-
-				</view>
-			</template>
-
-		</view>
-		<view  v-if="!packageData.orderItemList && !packageData.orderPartList" class="no-data">
-			暂无数据
+      <scroll-view scroll-y>
+        <template v-if="packageData.orderItemList">
+          <view  class="list-item-title border-bottom-solid">
+              <view class="list-item-cont">
+                <view class="name">
+                  <text >服务名称</text>
+                </view>
+
+                <view class="num">
+                  <text >使用次数</text>
+                </view>
+                <view class="time">
+                  <text >使用时间</text>
+                </view>
+              </view>
+
+          </view>
+
+          <view class="list-item " v-for="(item,index) in packageData.orderItemList" :key="index">
+            <view class="list-item-cont" :class="index != (packageData.orderItemList.length-1) ?'border-bottom-dashed':'' ">
+              <view class="name">
+                <text>{{item.itemName}}</text>
+              </view>
+              <view class="num">
+                <text >{{item.time}}次</text>
+              </view>
+              <text class="time">{{item.orderDate}}</text>
+            </view>
+
+          </view>
+          <!-- 分割区域 -->
+          <view v-if="packageData.orderPartList" class="list-br">
+
+          </view>
+        </template>
+
+        <template v-if="packageData.orderPartList">
+          <view  class="list-item-title border-bottom-solid">
+              <view class="list-item-cont">
+                <view class="name">
+                  <text >配件名称</text>
+                </view>
+
+                <view class="num">
+                  <text >使用数量</text>
+                </view>
+                <view class="time">
+                  <text >使用时间</text>
+                </view>
+              </view>
+
+          </view>
+
+          <view class="list-item " v-for="(item,index) in packageData.orderPartList" :key="index">
+            <view class="list-item-cont " :class="index != (packageData.orderPartList.length-1) ?'border-bottom-dashed':'' ">
+              <view class="name">
+                <text>{{item.partName}}</text>
+              </view>
+              <view class="num">
+                <text >{{item.quantity}} {{item.unit?item.unit:''}}</text>
+              </view>
+              <text class="time">{{item.orderDate}}</text>
+            </view>
+
+          </view>
+        </template>
+      </scroll-view>
+      <no-data :options="!packageData.orderItemList && !packageData.orderPartList" name="暂无套餐项目数据"/>
 		</view>
     </view>
 </template>
 
 <script>
+  import { getPackageDetail } from '@/api/packageRequest.js'
+  import NoData from '@/components/NoData';
     export default {
         components: {
+          'no-data': NoData
         },
         data() {
             return {
@@ -92,6 +93,26 @@
 
         },
         onLoad:function(option){
+        	console.log(option,"option")
+        	wx.showLoading({
+        	    title: '加载中'
+        	});
+        	let id = option.customerBundleId
+        	this.bundleName = option.bundleName
+        	console.log(id,'id')
+        	getPackageDetail({id:id}).then(res => {
+        		wx.hideLoading();
+        		if(res.status == 200){
+        			this.packageData = res.data
+        			console.log(_this.packageData.orderItemList,"_this.packageData")
+        		}else{
+        			wx.showToast({
+        			    title: res.message,
+        			    duration: 2000
+        			})
+        		}
+        	})
+
         },
         onReady() {
 
@@ -105,6 +126,9 @@
 		background: rgb(245,245,245);
 		color: rgb(40,40,40);
 		font-size: 30rpx;
+    height: calc(100vh);
+    overflow: hidden;
+    overflow-y: scroll;
 	}
 	.header-cont{
 		height: 110rpx;