yuwenjun 4 vuotta sitten
vanhempi
commit
a1c8622c3c
3 muutettua tiedostoa jossa 89 lisäystä ja 56 poistoa
  1. 60 46
      common/config/addressdata.js
  2. 12 2
      services/public.js
  3. 17 8
      services/user.service.js

+ 60 - 46
common/config/addressdata.js

@@ -1,64 +1,78 @@
 /*
  *请求获取省市区
  *已提供给地区选择picker组件使用
- */ 
-import { queryAddressInformation } from '@/services/public.js'
-const provinceData=[]
-const cityData=[]
-const areaData=[]
+ */
+import {
+	queryAddressInformation
+} from '@/services/public.js'
+const provinceData = []
+const cityData = []
+const areaData = []
 
-queryAddressInformation().then(res =>{
+queryAddressInformation().then(res => {
 	let list = res.data
 	list.forEach(item => {
 		let xxx = handleCitys(item)
 		provinceData.push(item)
 		cityData.push(xxx.e)
 		areaData.push(xxx.f)
+		let list = res.data
+		list.forEach(item => {
+			let xxx = handleCitys(item)
+			provinceData.push(item)
+			cityData.push(xxx.e)
+			areaData.push(xxx.f)
+		})
 	})
-})
-//获取市后继续处理
-function handleCitys(data) {
-    const x = []
-    const s = []
-    if (data.cityList.length) {
-        data.cityList.forEach(item => {
-			let xxx = handleTowns(item)
-			s.push(xxx)
+	//获取市后继续处理
+	function handleCitys(data) {
+		const x = []
+		const s = []
+		if (data.cityList.length) {
+			data.cityList.forEach(item => {
+				let xxx = handleTowns(item)
+				s.push(xxx)
+				x.push(item)
+			})
+		} else {
+			s.push([{
+				name: ''
+			}])
+			x.push([{
+				name: ''
+			}])
+		}
+		return {
+			e: x,
+			f: s,
+		}
+	}
+	//获取区后继续处理
+	function handleTowns(data) {
+		const x = []
+		data.townList.forEach(item => {
 			x.push(item)
-        })
-    }else{
-		s.push([{name:''}])
-		x.push([{name:''}])
+		})
+		return x
 	}
-    return {
-        e: x,
-        f: s,
-    }
-}
-//获取区后继续处理
-function handleTowns(data) {
-    const x = []
-    data.townList.forEach(item => {
-        x.push(item)
-    })
-    return x
-}
 
-function handleData3(data) {
-    const xxx = []
-    data.forEach(item => {
-        const ooo = []
-        item.forEach(opt => {
-           opt.forEach(z => {
-               ooo.push(z)
-           })
-        })
-        xxx.push(ooo)
-    })
-    return xxx
-}
+	function handleData3(data) {
+		const xxx = []
+		data.forEach(item => {
+			const ooo = []
+			item.forEach(opt => {
+				opt.forEach(z => {
+					ooo.push(z)
+				})
+			})
+			xxx.push(ooo)
+		})
+		return xxx
+	}
+
+})
 module.exports = {
 	provinceData,
 	cityData,
 	areaData
-}
+}

+ 12 - 2
services/public.js

@@ -1,3 +1,4 @@
+ZZ
 /**
  *@des 公共接口
  *@author zhengjinyi
@@ -18,7 +19,15 @@ export function queryAddressInformation() {
 			if (res.code == 0) {
 				resolve(res)
 			} else {
-				reject(res)
+				return new Promise(function(resolve, reject) {
+					request.get('/other/list', {}, res => {
+						if (res.code == 0) {
+							resolve(res)
+						} else {
+							reject(res)
+						}
+					})
+				})
 			}
 		})
 	})
@@ -152,7 +161,8 @@ export function uploadFileImage() {
 			success: (res) => {
 				const tempFilePaths = res.tempFilePaths
 				const uploadTask = uni.uploadFile({
-					url: requestUrl + '/formData/MultiPictareaddData',
+					url: requestUrl +
+						'/formData/MultiPictareaddData',
 					filePath: tempFilePaths[0],
 					name: 'file',
 					header: {

+ 17 - 8
services/user.service.js

@@ -26,7 +26,7 @@ export default class UserService {
 			isStatus: false
 		})
 	}
-	
+
 	/*维沙邀请码绑定*/
 	userInvitation(data = {}) {
 		return this.AjaxService.post({
@@ -37,7 +37,7 @@ export default class UserService {
 		})
 	}
 	/**
-	 * @机构-地址列表
+	 * @地址列表查询
 	 * @param:userId 用户ID(必传),
 	 * @param:pageNum 页码
 	 * @param:pageSize 每页条数
@@ -50,9 +50,7 @@ export default class UserService {
 		})
 	}
 	/**
-	 * @机构-添加&&修改地址
-	 * @param:userId 用户ID(必传),
-	 * @param:地址信息,
+	 * @添加&&修改地址
 	 */
 	AddNewAddress(data = {}) {
 		return this.AjaxService.post({
@@ -62,9 +60,8 @@ export default class UserService {
 		})
 	}
 	/**
-	 * @机构-删除地址
-	 * @param:userId 用户ID(必传),
-	 * @param:地址信息,
+	 * @删除地址
+	 * @param:addressId 地址ID,,
 	 */
 	DeleteNewAddress(data = {}) {
 		return this.AjaxService.get({
@@ -73,4 +70,16 @@ export default class UserService {
 			isLoading: true
 		})
 	}
+	/**
+	 * @设置默认地址
+	 * @param:userId 用户ID(必传),
+	 * @param:addressId 地址ID,
+	 */
+	DefaultAddress(data = {}) {
+		return this.AjaxService.get({
+			url: '/other/defaultAddress',
+			data,
+			isLoading: true
+		})
+	}
 }