Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

liyuan 2 napja
szülő
commit
c0cf5cf8cf

+ 2 - 2
common/setting.js

@@ -9,8 +9,8 @@ module.exports = {
 	// 版本号
 	version: '1.0.0',
 	// 开发环境接口Url
-	// devUrl: 'https://b2b.gubersail.com:9000/api',
-	devUrl: 'http://192.168.8.118:1080',
+	devUrl: 'https://b2b.gubersail.com:9000/api',
+	// devUrl: 'http://192.168.8.118:1080',
 	// 线上环境接口Url
 	// prodUrl: 'http://192.168.8.118:1080',
 	prodUrl: 'https://b2b.gubersail.com:9000/api',

+ 1 - 1
components/debounce-button.vue

@@ -1,6 +1,6 @@
 <template>
 	<button :type="type" :size="size" :class="['debounce-btn', disabled||readOnly ? 'disabled' : '']" :disabled="disabled||readOnly"
-		@click="handleClick" :style="{backgroundColor:bgColor,color:color}" :loading="loading">
+		@click="handleClick" :style="{backgroundColor:bgColor,color:color}" style="border-radius: 50px;" :loading="loading">
 		<slot>{{ text }}</slot>
 	</button>
 </template>

+ 45 - 6
http/api.js

@@ -10,7 +10,37 @@ import {
 } from '@/utils/base64.js';
 import Request from '@/utils/luch-request/index.js';
 const http = new Request(options);
-http.interceptors.request.use((config) => { // 可使用async await 做异步操作
+let isTokenExpired = false;
+// 检查网络状态函数
+const checkNetworkStatus = () => {
+	return new Promise((resolve, reject) => {
+		uni.getNetworkType({
+			success: (res) => {
+				console.log(res)
+				if (res.networkType === 'none') {
+					reject(new Error('网络连接已断开'));
+				} else {
+					resolve(true);
+				}
+			},
+			fail: () => {
+				reject(new Error('网络状态检测失败'));
+			}
+		});
+	});
+};
+
+http.interceptors.request.use(async (config) => { // 可使用async await 做异步操作
+	try {
+		await checkNetworkStatus();
+	} catch (error) {
+		uni.showToast({
+			title: error.message,
+			icon: 'none',
+			duration: 3000
+		});
+		return Promise.reject(config);
+	}
 	// 假设有token值需要在头部需要携带
 	let accessToken = uni.getStorageSync('accessToken');
 	if (accessToken) {
@@ -57,7 +87,7 @@ http.interceptors.response.use((response) => {
 				title: response.data.msg,
 				icon: 'none'
 			});
-		}else if (response.data.code === 403) {
+		} else if (response.data.code === 403) {
 			uni.showModal({
 				title: '提示',
 				content: response.data.msg,
@@ -72,7 +102,7 @@ http.interceptors.response.use((response) => {
 					}
 				}
 			});
-		}else if (response.data.code) {
+		} else if (response.data.code) {
 			return Promise.reject(response);
 		} else {
 			return response.data;
@@ -80,22 +110,31 @@ http.interceptors.response.use((response) => {
 	}
 	return response.data;
 }, (response) => {
-	
+	if (response.statusCode === 0 || !response.statusCode) {
+		uni.showToast({
+			title: '网络连接中断,请检查网络设置',
+			icon: 'none',
+			duration: 3000
+		});
+		return Promise.reject(response);
+	}
 	/*  对响应错误做点什么 (statusCode !== 200)*/
-	if (response.data.code === 401) {
+	if (response.data.code === 401&& !isTokenExpired) {
+		 isTokenExpired = true;
 		uni.showModal({
 			title: '提示',
 			content: '登录状态失效,点击确定重新登录',
 			showCancel: false,
 			success: function(res) {
 				if (res.confirm) {
+					 isTokenExpired = false;
 					uni.reLaunch({
 						url: '/pages/login/index'
 					});
 				}
 			}
 		});
-	}else if (response.data.error === "unauthorized") {
+	} else if (response.data.error === "unauthorized") {
 		if (response.data.error_description) {
 			uni.showToast({
 				title: response.data.error_description,

+ 4 - 3
manifest.json

@@ -2,8 +2,8 @@
     "name" : "库比森轮胎",
     "appid" : "__UNI__421BF74",
     "description" : "",
-    "versionName" : "1.0.13",
-    "versionCode" : 1013,
+    "versionName" : "1.0.17",
+    "versionCode" : 1017,
     "transformPx" : false,
     "plus" : {
         "distribute" : {
@@ -65,7 +65,8 @@
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
                     "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-feature android:name=\"android.hardware.camera\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
+                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>"
                 ],
                 "scope.camera" : {
                     "desc" : "用于拍照和录制视频"

+ 22 - 10
pages/activity/index.vue

@@ -1,8 +1,7 @@
 <template>
 	<view class="widthBox">
 		<view v-for="item in data" :key="item.id" @click.stop="jumpDetails(item)">
-			<image :src="item.url"
-				style="width: 100%;height: 350rpx;border-radius: 10rpx;" mode="scaleToFill">
+			<image :src="item.url" style="width: 100%;height: 350rpx;border-radius: 10rpx;" mode="scaleToFill">
 			</image>
 		</view>
 		<u-empty v-if="data.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
@@ -57,10 +56,16 @@
 			getBadge() {
 				shoppingCartList().then(res => {
 					let num = res.data.length
-					uni.setTabBarBadge({
-						index: 3, // tabIndex,tabBar的哪一项,从0开始
-						text: num.toString() // 显示的文本,超过 99 显示成 “…”
-					})
+					if (num) {
+						uni.setTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+							text: num.toString() // 显示的文本,超过 99 显示成 “…”
+						})
+					} else {
+						uni.removeTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+						})
+					}
 				})
 			},
 			// getUpdate() {
@@ -112,10 +117,17 @@
 					if (this.data.length == res.data.total) {
 						this.status = 'nomore'
 					}
-					uni.setTabBarBadge({
-						index: 1, // tabIndex,tabBar的哪一项,从0开始
-						text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
-					})
+					if (res.data.total) {
+						uni.setTabBarBadge({
+							index: 1, // tabIndex,tabBar的哪一项,从0开始
+							text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
+						})
+					} else {
+						uni.removeTabBarBadge({
+							index: 1, // tabIndex,tabBar的哪一项,从0开始
+						})
+					}
+
 					uni.hideLoading();
 				}).catch(err => {
 					uni.hideLoading();

+ 28 - 5
pages/goods/index.vue

@@ -1,8 +1,8 @@
 <template>
 	<view class="container">
 		<view style="background-color: #03803B;">
-			<uni-search-bar bgColor="#fff" v-model="name" placeholder="请输入综合查询" @confirm="custom"
-				@clear="custom" :radius="100" cancelButton="none">
+			<uni-search-bar bgColor="#fff" v-model="name" placeholder="请输入综合查询" @confirm="custom" @clear="custom"
+				:radius="100" cancelButton="none">
 			</uni-search-bar>
 		</view>
 		<view class="recentSearches" v-if="recentSearches.length != 0">
@@ -31,7 +31,8 @@
 				</u-tag>
 			</view>
 			<view style="margin:0 6rpx;">
-				<u-tag text="品牌" :bgColor="search.brandId?'#03803B':'#fff'" borderColor='#03803B' :color="search.brandId?'#fff':'#03803B'" @click="openBrand" size="mini">
+				<u-tag text="品牌" :bgColor="search.brandId?'#03803B':'#fff'" borderColor='#03803B'
+					:color="search.brandId?'#fff':'#03803B'" @click="openBrand" size="mini">
 				</u-tag>
 			</view>
 			<view style="margin:0 6rpx;width: 2rpx;height: 43rpx;background: #03803B;border-radius: 1rpx;"></view>
@@ -145,6 +146,9 @@
 	import {
 		isProcurement
 	} from '@/api/goods/index.js'
+	import {
+		shoppingCartList
+	} from '@/api/shoppingCart/index.js'
 	export default {
 		data() {
 			return {
@@ -180,7 +184,7 @@
 				},
 				search: {
 					whether: '0',
-					brandId:null,
+					brandId: null,
 				},
 				checkStatus: null,
 				recentSearches: [], // 搜索数据
@@ -225,12 +229,29 @@
 					})
 				}
 			})
+
+			this.getBadge()
 			// 获取最近搜索数据
 			if (uni.getStorageSync('recentSearches')) {
 				this.recentSearches = uni.getStorageSync('recentSearches').slice(0, 8);
 			}
 		},
 		methods: {
+			getBadge() {
+				shoppingCartList().then(res => {
+					let num = res.data.length
+					if (num) {
+						uni.setTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+							text: num.toString() // 显示的文本,超过 99 显示成 “…”
+						})
+					} else {
+						uni.removeTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+						})
+					}
+				})
+			},
 			opensalesman() {
 				if (this.checkStatus != '审核通过') {
 					uni.showToast({
@@ -294,7 +315,7 @@
 				this.checkboxValue = []
 				this.search = {
 					whether: '0',
-					brandId:null
+					brandId: null
 				}
 				this.$refs.paging.reload()
 			},
@@ -360,6 +381,7 @@
 							title: "加入购物车成功",
 							icon: "none",
 						});
+						this.getBadge()
 						uni.hideLoading();
 					}).catch(err => {
 						uni.hideLoading();
@@ -562,6 +584,7 @@
 			position: relative;
 			top: 6rpx;
 			height: 36rpx;
+
 			.cardKc {
 				text-align: center;
 				position: absolute;

+ 0 - 2
pages/home/claim/details.vue

@@ -180,7 +180,6 @@
 					value: 'code',
 					children: 'children'
 				},
-				addressData: [],
 				labelList: [],
 				corpsTypeList: [],
 				storeAttributesList: [],
@@ -189,7 +188,6 @@
 			}
 		},
 		onLoad(option) {
-			this.addressData = JSON.parse(uni.getStorageSync("addressData"))
 			if (option && option.id) {
 				this.getDetail(option.id)
 			}

+ 21 - 13
pages/home/index.vue

@@ -47,7 +47,7 @@
 				<uni-grid-item>
 					<view class="grid-item-box" @click="allClick('轮胎保注册')">
 						<view class="grid-item-box-img">
-							<image style="width: 100rpx;height: 80rpx;" src="@/static/images/home/home (17).png" />
+							<image style="width: 80rpx;height: 80rpx;" src="@/static/images/home/baoxian.png" />
 						</view>
 						<view class="grid-item-box-text">
 							轮胎保
@@ -57,7 +57,7 @@
 				<uni-grid-item>
 					<view class="grid-item-box" @click="allClick('保单')">
 						<view class="grid-item-box-img">
-							<image style="width: 100rpx;height: 80rpx;" src="@/static/images/home/home (18).png" />
+							<image style="width: 80rpx;height: 80rpx;" src="@/static/images/home/chexian.png" />
 						</view>
 						<view class="grid-item-box-text">
 							保单
@@ -123,7 +123,7 @@
 	} from '@/api/home/index.js'
 	import {
 		shoppingCartList
-	} from '@/api/goods/index.js'
+	} from '@/api/shoppingCart/index.js'
 	import {
 		details,
 		nameDetail
@@ -213,11 +213,6 @@
 			}
 		},
 		onLoad() {
-			if (uni.getStorageSync('accessToken')) {
-				this.getAddressdata()
-			}
-			// this.getbrandDescList()
-
 			this.page = {
 				total: 0,
 				size: 10,
@@ -228,7 +223,7 @@
 		},
 		onShow() {
 			this.getDetails()
-			// this.getBadge()
+			this.getBadge()
 			this.$u.api.isDisable()
 		},
 		mounted() {
@@ -266,10 +261,17 @@
 				// })
 				shoppingCartList().then(res => {
 					let num = res.data.length
-					uni.setTabBarBadge({
-						index: 3, // tabIndex,tabBar的哪一项,从0开始
-						text: num.toString() // 显示的文本,超过 99 显示成 “…”
-					})
+					if (num) {
+						uni.setTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+							text: num.toString() // 显示的文本,超过 99 显示成 “…”
+						})
+					} else {
+						uni.removeTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+						})
+					}
+
 				})
 			},
 			getbrandDescList() {
@@ -449,6 +451,11 @@
 			},
 			allClick(name) {
 				this.$u.api.isDisable()
+				if (name == '新建注册') {
+					uni.navigateTo({
+						url: '/pages/home/insurance/details'
+					});
+				}
 				if (name == '轮胎保注册') {
 					uni.navigateTo({
 						url: '/pages/home/insurance/index'
@@ -537,6 +544,7 @@
 				display: flex;
 				flex-direction: column;
 				align-items: center;
+				padding: 20rpx 0;
 
 				.uni-grid-item__box {
 					justify-content: center;

+ 3 - 9
pages/home/insurance/details.vue

@@ -31,12 +31,8 @@
 						placeholder-class="placeholder-right" placeholder="请输入内容" :inputBorder="false"
 						:disabled="form.status>0" :clearable="false"></uni-easyinput>
 				</uni-forms-item> -->
-				<uni-forms-item name="vehicleNumber" label="车牌号">
+				<uni-forms-item name="vehicleNumber" label="车牌号" required>
 					<view style="display: flex;align-items: center;">
-						<!-- <uni-easyinput v-model="form.vehicleNumber" class="right-align"
-							placeholder-class="placeholder-right" placeholder="请输入车牌号" :inputBorder="false"
-							:disabled="form.status>0" :clearable="false" @change="carNoVerify"
-							maxlength="8"></uni-easyinput> -->
 						<view style="display: flex;align-items: center;height: 36px;width: 100%;">
 							<view @click="handleInputFocus()" style="width: 100%;text-align: right;padding: 0 20rpx;"
 								:style="form.vehicleNumber?'color:#000;':'color:#B5B4B4;font-size: 24rpx;'">
@@ -75,7 +71,7 @@
 					<uni-forms-item name="tyreNo" label="胎号">
 						<view style="display: flex;align-items: center;">
 							<uni-easyinput v-model="item.tyreNo" class="right-align"
-								placeholder-class="placeholder-right" placeholder="请输入胎号" :inputBorder="false"
+								placeholder-class="placeholder-right" :placeholder="form.status>0?' ':'请输入胎号'" :inputBorder="false"
 								:disabled="form.status>0" :clearable="false"
 								@change="getMaterialDetail($event,activeTab)"></uni-easyinput>
 							<uni-icons v-if="!form.status>0" type="scan" size="24" color='#03803B'
@@ -164,7 +160,7 @@
 			<view
 				style="width: 470rpx;height: 470rpx;background-color: #fff;display: flex;flex-direction: column;align-items: center;justify-content: center;">
 				<image style="width: 400rpx;height: 400rpx;" :src="form.fileUrl" />
-				<view class="">
+				<view style="font-size: 22rpx;">
 					请使用车主小程序扫码查询轮胎保进度
 				</view>
 			</view>
@@ -267,7 +263,6 @@
 					value: 'code',
 					children: 'children'
 				},
-				addressData: [],
 				labelList: [],
 				corpsTypeList: [],
 				storeAttributesList: [],
@@ -280,7 +275,6 @@
 			}
 		},
 		onLoad(option) {
-			this.addressData = JSON.parse(uni.getStorageSync("addressData"))
 			if (option && option.id) {
 				this.getDetail(option.id)
 			} else {

+ 4 - 3
pages/home/insurance/index.vue

@@ -32,9 +32,9 @@
 								<view style="font-weight: 800;color: #03803B;">
 									{{item.vehicleNumber||'暂无车牌'}}
 								</view>
-								<view class="">
+								<!-- <view class="">
 									轮胎规格: {{item.tyreSpecs||'-'}}
-								</view>
+								</view> -->
 							</view>
 							<view class="list-item">
 								<view class="">
@@ -162,7 +162,8 @@
 				try {
 					const obj = {
 						current: pageNo,
-						size: pageSize
+						size: pageSize,
+						searchCriteria:this.searchValue
 					}
 					const res = await getList(obj)
 					this.$refs.paging.complete(res.data.records)

+ 1 - 1
pages/home/insurance/rules.vue

@@ -88,7 +88,7 @@
 			</view>
 			<view style="display: flex;justify-content: center;padding-bottom:40rpx;">
 
-				<button class="button_1 flex-col" @click="inEdit" :disabled="counting">
+				<button class="button_1 flex-col" style="border-radius: 50px;" @click="inEdit" :disabled="counting">
 					{{ buttonText }}
 				</button>
 			</view>

+ 6 - 2
pages/login/index.vue

@@ -72,6 +72,7 @@
 				phone:uni.getStorageSync('phone'), //手机号码
 				code: '', //验证码
 				uuid: uuidv4(),
+				sendBtn:false,
 			};
 		},
 		onLoad() {},
@@ -148,11 +149,12 @@
 					});
 					return;
 				}
-				
 				let obj = {
 					phone: this.phone,
 					uuid: this.uuid
 				}
+				if (this.sendBtn) return
+				this.sendBtn = true
 				getPhoneVerifyCode(obj).then(res => {
 					uni.showToast({
 						title: res.msg,
@@ -172,7 +174,9 @@
 							that.showText = true;
 						}, 60000);
 					}
-				})
+				}).finally(() => {
+					this.sendBtn = false
+				});
 			},
 			//等三方微信登录
 			wxLogin() {

+ 18 - 20
pages/me/index.vue

@@ -8,7 +8,7 @@
 					</image>
 				</view>
 				<view style="color:#fff;margin-left: 13rpx;font-size: 30rpx;font-weight: 500;">
-					{{userData.user_name?userData.user_name:''}}
+					{{shopInfo.cname?shopInfo.cname:''}}
 				</view>
 			</view>
 		</view>
@@ -68,7 +68,7 @@
 				</u-cell>
 			</u-cell-group>
 			<view style="display: flex;justify-content: space-around;">
-<!--				<view style="display: flex;flex-direction:column;align-items: center;" @click="obligationBtn('待付款')">
+				<!--				<view style="display: flex;flex-direction:column;align-items: center;" @click="obligationBtn('待付款')">
 					<image src="/static/images/me/280@2x(1).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
 					</image>
 					<view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">待付款</view>
@@ -136,6 +136,9 @@
 </template>
 
 <script>
+	import {
+		getAppDetails
+	} from '@/api/home/store.js'
 	export default {
 		data() {
 			return {
@@ -145,24 +148,19 @@
 				badgeList: [],
 				form: {},
 				adminShow: false,
+				shopInfo: {}
 			}
 		},
 		onShow() {
 			this.$u.api.isDisable()
 			this.getUpdate()
-			this.getUserData()
+			this.getAppDetails()
 		},
 		methods: {
-			getUserData() {
-				// details().then(res => {
-				// 	this.userData = res.data
-				// 	corpPointsDetail({
-				// 		corpId: res.data.id
-				// 	}).then(e => {
-				// 		this.form = e.data
-				// 		this.form.recoveredBalance = res.data.recoveredBalance
-				// 	})
-				// })
+			getAppDetails() {
+				getAppDetails().then(res => {
+					this.shopInfo = res.data
+				})
 			},
 			showActionSheet() {
 				if (this.userData.checkStatus != '通过') {
@@ -289,32 +287,32 @@
 				this.$u.route('/pages/me/setting/index');
 			},
 			allClick(name) {
-				if (name == '我的订单'){
+				if (name == '我的订单') {
 					uni.navigateTo({
 						url: '/pages/me/myOrder',
 					});
 				}
-				if(name=='待发货'){
+				if (name == '待发货') {
 					uni.navigateTo({
 						url: '/pages/me/myOrder?xcxStatus=待发货&current=1',
 					});
 				}
-				if(name=='待收货'){
+				if (name == '待收货') {
 					uni.navigateTo({
 						url: '/pages/me/myOrder?xcxStatus=待收货&current=2',
 					});
 				}
-				if(name=='已收货'){
+				if (name == '已收货') {
 					uni.navigateTo({
 						url: '/pages/me/myOrder?xcxStatus=已收货&current=3',
 					});
 				}
-				if(name=='退款售后'){
+				if (name == '退款售后') {
 					uni.navigateTo({
 						url: '/pages/me/myOrder?xcxStatus=退款请核,退款中,已取消&current=4',
 					});
 				}
-				if(name=='个人资料'){
+				if (name == '个人资料') {
 					uni.navigateTo({
 						url: '/pages/me/myInfo',
 					});
@@ -479,4 +477,4 @@
 			color: #797979;
 		}
 	}
-</style>
+</style>

+ 11 - 44
pages/shoppingCart/index.vue

@@ -161,17 +161,6 @@
 			this.getTabbarHeight()
 		},
 		onShow() {
-			this.getUpdate()
-			// activityList({
-			// 	current: 1,
-			// 	size: 10,
-			// 	status: 1
-			// }).then(res => {
-			// 	uni.setTabBarBadge({
-			// 		index: 1, // tabIndex,tabBar的哪一项,从0开始
-			// 		text: res.data.total.toString() // 显示的文本,超过 99 显示成 “…”
-			// 	})
-			// })
 			// 获取审核状态
 			details().then(res => {
 				this.checkStatus = res.data.checkStatus
@@ -203,34 +192,6 @@
 				// #endif
 
 			},
-			getUpdate() {
-				const updateManager = uni.getUpdateManager();
-				updateManager.onCheckForUpdate(function(res) {
-					// 请求完新版本信息的回调
-					if (res.hasUpdate) {
-						updateManager.onUpdateReady(function() {
-							uni.showModal({
-								title: '更新提示',
-								content: '新版本已经准备好,是否重启应用?',
-								success: function(res) {
-									if (res.confirm) {
-										// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
-										updateManager.applyUpdate();
-									}
-								}
-							});
-						});
-
-						updateManager.onUpdateFailed(function() {
-							// 新的版本下载失败
-							uni.showModal({
-								title: '已经有新版本了哟~',
-								content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
-							});
-						});
-					}
-				});
-			},
 			// 库存弹窗
 			inventoryfun(arr) {
 				let sum = ''
@@ -257,10 +218,16 @@
 					this.radiovalue = []
 					const res = await shoppingCartList()
 					this.companyValueLength = res.data.length
-					uni.setTabBarBadge({
-						index: 3, // tabIndex,tabBar的哪一项,从0开始
-						text: this.companyValueLength.toString() // 显示的文本,超过 99 显示成 “…”
-					})
+					if(this.companyValueLength){
+						uni.setTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+							text: this.companyValueLength.toString() // 显示的文本,超过 99 显示成 “…”
+						})
+					}else{
+						uni.removeTabBarBadge({
+							index: 3, // tabIndex,tabBar的哪一项,从0开始
+						})
+					}
 					this.$refs.paging.complete(res.data)
 				} catch (e) {
 					this.$refs.paging.complete(false)
@@ -339,7 +306,7 @@
 										icon: 'none',
 										duration: 2000
 									});
-									// _this.$refs.paging.reload();
+									_this.$refs.paging.reload();
 									// uni.navigateTo({
 									// 	url: '/pages/settlement/index'
 									// })

+ 1 - 1
static/customicons.css

@@ -28,7 +28,7 @@
 	// display: flex;
 	// flex-direction: column;
 	position: fixed;
-	z-index:99999;
+	z-index:1000;
 	left: 0;
 	right: 0;
 	/* #ifdef H5 */

BIN
static/images/home/baoxian.png


BIN
static/images/home/chexian.png