소스 검색

Merge branch 'master' of http://47.98.226.240:3000/twt/epc

* 'master' of http://47.98.226.240:3000/twt/epc:
  代码提交
guo 2 년 전
부모
커밋
001911d570
6개의 변경된 파일512개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 3
      common/request.js
  2. 7 1
      pages.json
  3. 6 1
      pages/mobile/index.vue
  4. 3 3
      pages/mobile/modelTwo.vue
  5. 326 0
      pages/mobile/vinDetail.vue
  6. 167 0
      utils/index.js

+ 3 - 3
common/request.js

@@ -1,9 +1,9 @@
-
+import { getHashQuery } from '../utils/index.js'
 const baseUrl = 'http://api.dms.66km.com.cn/'
 const burl2='http://api.dms.66km.com.cn/' 
 import md5 from './MD5.js'
-
-
+var token=getHashQuery('token')
+console.log(token)
 
 
 const http = (url = '', date = {}, type = 'POST', header = {

+ 7 - 1
pages.json

@@ -131,7 +131,13 @@
                 "navigationStyle": "custom"
             }
             
-        }
+        },{
+			"path": "pages/mobile/vinDetail",
+			"style": {
+				"navigationBarTitleText": "车型件",
+				"enablePullDownRefresh": true
+			}
+		}
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 6 - 1
pages/mobile/index.vue

@@ -13,7 +13,7 @@
 				<image src="../../static/img/icon_delete.png" mode="" class="historyDelImg"></image>
 			</view>
 			<view v-for="(item,index) in 3" class="historyLIneBox">
-				<view class="historyLIne" @click="gogroup">LF0HGCT23F0026063</view>
+				<view class="historyLIne" @click="gogroup2('LVHFC1663G6003140')">LVHFC1663G6003140</view>
 			</view>
 				
 			
@@ -41,6 +41,11 @@
 				uni.navigateTo({
 					url:'group?vin='+this.vin
 				})
+			},
+			gogroup2(vin){
+				uni.navigateTo({
+					url:'group?vin='+vin
+				})
 			}
 		}
 	}

+ 3 - 3
pages/mobile/modelTwo.vue

@@ -33,7 +33,7 @@
 				</view>
 			</view>
 			
-			<view class="mainLine" v-for="(item,index) in childrenList" @click="goThree(item)" v-if="lastShow">
+			<view class="mainLine" v-for="(item,index) in childrenList" @click="goThree(item,index)" v-if="lastShow">
 				<view class="lineLeft">
 					<image class="lineIMg" :src="item.image_url" v-if="item.image_url" mode="aspectFit"></image>
 					<image  class="lineIMg" src="../../static/img/noimg.png" v-else mode="aspectFit"></image>
@@ -226,9 +226,9 @@
 					url:'CarDetail'
 				})
 			},
-             goThree(item){
+             goThree(item,index){
 				 uni.navigateTo({
-				 	url:'modelThree?vin='+this.vin+'&token='+item.token+'&param='+item.param+'&access_time='+this.access_time
+				 	url:'vinDetail?vin='+this.vin+'&token='+item.token+'&param='+item.param+'&access_time='+this.access_time+'&tabIndex='+index
 				 })
 			 },
 			 childrenkeyup(){

+ 326 - 0
pages/mobile/vinDetail.vue

@@ -0,0 +1,326 @@
+<template>
+	<view class="content">
+		<view class="top">
+			<image class="topIMg" :src=imgUrl mode="">
+			</image>
+			<image @click="previewImage(imgUrl)" src="../../static/img/icon_fangda@2x.png" mode="" class="enlarge">
+			</image>
+		</view>
+		<view style="height: 20rpx;background: #F4F5F7;"></view>
+		<view class="mainBox">
+			<view v-if="oemSearch == false" class="mainTop">
+				<view class="arrowBox">
+					<image src="../../static/img/icon_arrow_blue_l@2x.png" mode="" class="arrow"></image>
+					<view class="title" @click="upGroup">上一组</view>
+				</view>
+				<view class="page">{{tabIndex}}/{{groupData.length}}</view>
+				<view class="arrowBox">
+					<view class="title" @click="downGroup">下一组</view>
+					<image src="../../static/img/icon_arrow_blue_r@2x.png" mode="" class="arrow"></image>
+				</view>
+			</view> 
+
+			<view class="commentBox" v-for="(item,index) in itemList" :key="index">
+				<view class="line">
+					<view class="wei">位置{{item.refernum}}</view>
+					<view class="yong">用量{{item.qty}}</view>
+				</view>
+				<view class="name">{{item.description}}</view>
+				<view class="comment">{{item.remark}}</view>
+				<view class="forLine">
+					<view @click="goOemDetail(item)" class="code">{{item.extened}}</view>
+					<view class="price">4S店价:
+						<span class="orangePrice">¥ {{item.price}}</span>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				title: 'Hello',
+				vin: '',
+				epc_id: '',
+				token: '',
+				param: '',
+				access_time: '',
+				oemSearch: '',
+				groupData: [],
+				itemList: [],
+				imgUrl: '',
+				tabIndex: 1,
+				son_vin: '',
+				son_epc_id: '',
+				son_token: '',
+				son_param: '',
+				son_access_time: '',
+				page: 1,
+				total_page: 1
+			}
+		},
+		onLoad(opt) {
+			// console.log('opt++',opt);
+			this.vin = opt.vin;
+			this.tabIndex = opt.tabIndex;
+			this.token = opt.token;
+			this.param = opt.param;
+			this.access_time = opt.access_time;
+			this.getPeijianData();
+
+
+		},
+		methods: {
+			upGroup() {
+				this.tabIndex -= 1;
+				if (this.tabIndex <= 0) {
+					this.tabIndex = 1
+				}
+
+				this.son_param = this.groupData[this.tabIndex - 1].param;
+				this.son_token = this.groupData[this.tabIndex - 1].token;
+
+
+				this.getItemData();
+			},
+			downGroup() {
+				this.tabIndex += 1;
+				if (this.tabIndex >= this.groupData.length) {
+					this.tabIndex = this.groupData.length
+				}
+
+				this.son_param = this.groupData[this.tabIndex - 1].param;
+				this.son_token = this.groupData[this.tabIndex - 1].token;
+
+
+				this.getItemData();
+			},
+			/*
+			// 车型子组列表
+			getGroupData() {
+				var that = this
+				uni.showLoading({
+					title: '加载中'
+				});
+				this.$http('/advancedEpc/getSubgroupPc', {
+					vin: this.vin,
+					epc_id: this.epc_id,
+					token: this.token,
+					param: this.param,
+					access_time: this.access_time,
+				}, 'GET').then(res => {
+					uni.hideLoading();
+					
+					this.groupData = res.data.result.list;
+					
+					this.son_epc_id = res.data.result.epc_id;
+					this.son_access_time = res.data.result.access_time;
+					
+					that.groupData.forEach((item, index) => {
+						if (item.group_no.includes(that.group_no)) {
+							console.log('有index',index);
+						}
+					})
+					this.son_param = this.groupData[0].param;
+					this.son_token = this.groupData[0].token;
+					
+					
+					that.getItemData();
+				});
+			},
+			*/
+			// 子组配件列表
+			getItemData() {
+
+				uni.showLoading({
+					title: '加载中'
+				});
+				this.$http('/advancedEpc/getPartsPc', {
+					vin: this.son_vin,
+					token: this.son_token,
+					param: this.son_param,
+					access_time: this.son_access_time,
+				}, 'GET').then(res => {
+					uni.hideLoading();
+
+					this.itemList = res.data.result.list.rows;
+					this.imgUrl = res.data.result.list.image_info[0].pic_url;
+					console.log('itemList++', this.itemList);
+				});
+			},
+			// oem子组配件列表
+			getPeijianData() {
+
+				uni.showLoading({
+					title: '加载中'
+				});
+				this.$http('/advancedEpc/getPartsPc', {
+					vin: this.vin,
+					token: this.token,
+					param: this.param,
+					access_time: this.access_time,
+					page: this.page,
+				}, 'GET').then(res => {
+					uni.hideLoading();
+
+
+					this.imgUrl = res.data.result.list.image_info[0].pic_url;
+
+					this.total_page = res.data.result.total_page;
+
+					var list = res.data.result.list.rows;
+					if (list.length != 0) {
+						this.itemList = this.itemList.concat(list)
+					}
+					console.log('itemList++', this.itemList);
+				});
+			},
+			goOemDetail(item) {
+				uni.navigateTo({
+					url: 'OemDetail?epc_id=' + this.epc_id + '&partsnum=' + item.partnum + '&weizhi=' + item
+						.refernum + '&yongliang=' + item.qty
+				})
+			},
+			previewImage(imgUrl) {
+				var arr = [];
+				var img = imgUrl
+				arr.push(img)
+
+				// 预览图片
+				uni.previewImage({
+					urls: arr,
+					current: img,
+					longPressActions: {
+						itemList: ['发送给朋友', '保存图片', '收藏'],
+						success: function(data) {
+							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
+						},
+						fail: function(err) {
+							console.log(err.errMsg);
+						}
+					}
+				});
+			}
+		},
+		onReachBottom() {
+			if (this.page <= this.total_page) {
+				this.page++;
+
+				this.getPeijianData()
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.topIMg {
+		width: 100%;
+		display: block;
+	}
+
+	.top {
+		position: relative;
+	}
+
+	.enlarge {
+		position: absolute;
+		width: 44rpx;
+		height: 44rpx;
+		right: 30rpx;
+		bottom: 34rpx;
+	}
+
+	.mainBox {
+		width: 100vw;
+	}
+
+	.mainTop {
+		padding: 28rpx 25rpx;
+		display: flex;
+		justify-content: space-between;
+		border-bottom: 1rpx solid #EEEEEE;
+	}
+
+	.arrowBox {
+		display: flex;
+		align-items: center;
+	}
+
+	.arrow {
+		width: 25rpx;
+		height: 24rpx;
+	}
+
+	.title {
+		font-size: 24rpx;
+		color: #3F90F7;
+	}
+
+	.page {
+		font-size: 28rpx;
+		color: #333333;
+	}
+
+	.commentBox {
+
+		padding: 20rpx 24rpx;
+		border-bottom: 1rpx solid #EEEEEE;
+	}
+
+	.line {
+		display: flex;
+		align-items: center;
+	}
+
+	.wei {
+		color: #F19D01;
+		font-size: 22rpx;
+		background: #FDF7EB;
+		border-radius: 4px;
+		padding: 0 8rpx;
+	}
+
+	.yong {
+		color: #666666;
+		font-size: 22rpx;
+		margin-left: 10rpx;
+	}
+
+	.name {
+		color: #333333;
+		font-size: 26rpx;
+		font-weight: bold;
+		padding-top: 16rpx;
+		padding-bottom: 10rpx;
+	}
+
+	.comment {
+		color: #999999;
+		font-size: 24rpx;
+		padding-bottom: 14rpx;
+	}
+
+	.forLine {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+	}
+
+	.code {
+		color: #3F90F7;
+		font-size: 24rpx;
+	}
+
+	.price {
+		color: #999999;
+		font-size: 24rpx;
+	}
+
+	.orangePrice {
+		color: #FF4F00;
+		font-weight: bold;
+	}
+</style>

+ 167 - 0
utils/index.js

@@ -0,0 +1,167 @@
+/**
+ * Created by PanJiaChen on 16/11/18.
+ */
+
+/**
+ * Parse the time to string
+ * @param {(Object|string|number)} time
+ * @param {string} cFormat
+ * @returns {string}
+ */
+export function parseTime(time, cFormat) {
+  if (arguments.length === 0) {
+    return null
+  }
+  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
+  let date
+  if (typeof time === 'object') {
+    date = time
+  } else {
+    if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
+      time = parseInt(time)
+    }
+    if ((typeof time === 'number') && (time.toString().length === 10)) {
+      time = time * 1000
+    }
+    date = new Date(time)
+  }
+  const formatObj = {
+    y: date.getFullYear(),
+    m: date.getMonth() + 1,
+    d: date.getDate(),
+    h: date.getHours(),
+    i: date.getMinutes(),
+    s: date.getSeconds(),
+    a: date.getDay()
+  }
+  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
+    let value = formatObj[key]
+    // Note: getDay() returns 0 on Sunday
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+    if (result.length > 0 && value < 10) {
+      value = '0' + value
+    }
+    return value || 0
+  })
+  return time_str
+}
+
+/**
+ * @param {number} time
+ * @param {string} option
+ * @returns {string}
+ */
+export function formatTime(time, option) {
+  if (('' + time).length === 10) {
+    time = parseInt(time) * 1000
+  } else {
+    time = +time
+  }
+  const d = new Date(time)
+  const now = Date.now()
+
+  const diff = (now - d) / 1000
+
+  if (diff < 30) {
+    return '刚刚'
+  } else if (diff < 3600) {
+    // less 1 hour
+    return Math.ceil(diff / 60) + '分钟前'
+  } else if (diff < 3600 * 24) {
+    return Math.ceil(diff / 3600) + '小时前'
+  } else if (diff < 3600 * 24 * 2) {
+    return '1天前'
+  }
+  if (option) {
+    return parseTime(time, option)
+  } else {
+    return (
+      d.getMonth() +
+      1 +
+      '月' +
+      d.getDate() +
+      '日' +
+      d.getHours() +
+      '时' +
+      d.getMinutes() +
+      '分'
+    )
+  }
+}
+
+/**
+ * @param {string} url
+ * @returns {Object}
+ */
+export function param2Obj(url) {
+  const search = url.split('?')[1]
+  if (!search) {
+    return {}
+  }
+  return JSON.parse(
+    '{"' +
+    decodeURIComponent(search)
+      .replace(/"/g, '\\"')
+      .replace(/&/g, '","')
+      .replace(/=/g, '":"')
+      .replace(/\+/g, ' ') +
+    '"}'
+  )
+}
+
+/**
+ * Check if an element has a class
+ * @param {HTMLElement} elm
+ * @param {string} cls
+ * @returns {boolean}
+ */
+export function hasClass(ele, cls) {
+  return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
+}
+
+/**
+ * Add class to element
+ * @param {HTMLElement} elm
+ * @param {string} cls
+ */
+export function addClass(ele, cls) {
+  if (!hasClass(ele, cls)) ele.className += ' ' + cls
+}
+
+/**
+ * Remove class from element
+ * @param {HTMLElement} elm
+ * @param {string} cls
+ */
+export function removeClass(ele, cls) {
+  if (hasClass(ele, cls)) {
+    const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
+    ele.className = ele.className.replace(reg, ' ')
+  }
+}
+
+/**
+ * 深度合并对象
+ * @param FirstOBJ
+ * @param SecondOBJ
+ * @returns {*}
+ */
+export const deepObjectMerge = function(FirstOBJ, SecondOBJ) {
+  for (var key in SecondOBJ) {
+    FirstOBJ[key] = FirstOBJ[key] && FirstOBJ[key].toString() === '[object Object]' ? deepObjectMerge(FirstOBJ[key], SecondOBJ[key]) : FirstOBJ[key] = SecondOBJ[key]
+  }
+  return FirstOBJ
+}
+
+export function getHashQuery (query) {
+  if (location.hash.indexOf(query) > -1) {
+    let cur = location.hash.slice(location.hash.indexOf(query) + query.length + 1, location.hash.length)
+    if (cur.indexOf('&') > -1) {
+      return cur.slice(0, cur.indexOf('&'))
+    } else {
+      return cur
+    }
+  } else {
+    return false
+  }
+}