Pārlūkot izejas kodu

commit -m 订单模块接口联调

zhengjinyi 3 gadi atpakaļ
vecāks
revīzija
4261a80d97

+ 8 - 22
common/config/addressdata.js

@@ -14,19 +14,19 @@ const areaData=[];
 _PublicService.GetAllAddressData().then(res =>{
 	let list = res.data;
 	list.forEach(item => {
-		let xxx = handleCitys(item);
+		let address = handleCitys(item);
 		provinceData.push(item);
-		cityData.push(xxx.e);
-		areaData.push(xxx.f);
+		cityData.push(address.e);
+		areaData.push(address.f);
 	})
 	//获取市后继续处理
 	function handleCitys(data) {
 	    const x = [];
 	    const s = [];
-	    if (data.cityList.length) {
-	        data.cityList.forEach(item => {
-				let xxx = handleTowns(item);
-				s.push(xxx);
+	    if (data.children.length) {
+	        data.children.forEach(item => {
+				let city = handleTowns(item);
+				s.push(city);
 				x.push(item)
 	        })
 	    }else{
@@ -41,25 +41,11 @@ _PublicService.GetAllAddressData().then(res =>{
 	//获取区后继续处理
 	function handleTowns(data) {
 	    const x = [];
-	    data.townList.forEach(item => {
+	    data.children.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;
-	}
 })
 module.exports = {
 	provinceData,

+ 9 - 3
components/cm-module/cart-components/index.vue

@@ -440,7 +440,7 @@
 				}, 500)
 			},
 			initGetCartGoodsList(){//初始化购物车 index:1
-				this.ProductService.QueryShoppingCartList({userId:this.userId}).then(response =>{
+				this.ProductService.QueryShoppingCartList({userId:this.userId,source:2}).then(response =>{
 					this.skeletonShow = false
 					let data = response.data
 					this.kindCount = data.kindCount
@@ -853,8 +853,14 @@
 				}
 			},
 			updateShoppogNum(pros){//加减购物车商品更新到后台
-				let params ={userID:this.userId,productID:pros.productId,productCount:pros.number}
-				this.ProductService.ShoppingCartUpdate(params).then(response =>{
+				this.ProductService.ShoppingCartUpdate(
+					{
+						userId:this.userId,
+						productId:pros.productId,
+						productCount:pros.number,
+						source:2,
+					}
+				).then(response =>{
 					this.isshowDelbtn = false;
 					this.initGetCartGoodsList();
 				}).catch(error =>{

+ 3 - 3
components/mpvue-citypicker/mpvueCityPicker.vue

@@ -149,13 +149,13 @@
 				return pcikerLabel;
 			},
 			_getTownCode() {
-				return this.areaDataList[this.pickerValue[2]].townID;
+				return this.areaDataList[this.pickerValue[2]].id;
 			},
 			_getCityCode() {
-				return this.cityDataList[this.pickerValue[1]].cityID;
+				return this.cityDataList[this.pickerValue[1]].id;
 			},
 			_getProvinceCode() {
-				return this.provinceDataList[this.pickerValue[0]].provinceID;
+				return this.provinceDataList[this.pickerValue[0]].id;
 			}
 		}
 	};

+ 9 - 2
pages/goods/product.vue

@@ -837,7 +837,14 @@
 				}, 200);
 			},
 			getAddProductCart(){//增加购物车成功和toast弹窗提示成功	
-				this.ProductService.shoppingAddCart({productID:this.productId,userID:this.userId,productCount:this.number}).then(response => {
+				this.ProductService.shoppingAddCart(
+					{
+						productId:this.productId,
+						userId:this.userId,
+						productCount:this.number,
+						source:2
+					}
+				).then(response => {
 					this.specClass = 'hide';
 					this.$util.msg('加入购物车成功',1500,true,'success')
 					this.isAnimation = true
@@ -845,7 +852,7 @@
 					setTimeout(() => {this.isAnimation = false},2000)
 					this.bottomCartNumber = response.data;
 				}).catch(error =>{
-					this.$util.msg(error.msg,2000);
+					console.log('error',error.msg)
 				})
 			},
 			setHeaderBtnPosi(){

+ 40 - 47
pages/user/address/address.vue

@@ -11,7 +11,7 @@
 				<view class="list" v-for="(item, index) in addressList" :key="index" @click="checkAddress(item)">
 					<view class="wrapper">
 						<view class="u-box">
-							<text class="name">{{item.shouHuoRen}}</text>
+							<text class="name">{{item.receiver}}</text>
 							<text class="mobile">{{item.mobile}}</text>
 						</view>
 						<view class="u-box b-b">
@@ -23,7 +23,7 @@
 							</view>
 							<view v-else class="tag-left"></view>
 							<view class="tag-right">
-								<view class="t-b"  @click.stop="deleteAddress(item.addressID)">
+								<view class="t-b"  @click.stop="deleteAddress(item.addressId)">
 									<text class="iconfont icon-shanchu"></text>
 									<text class="txt">删除</text>
 								</view>
@@ -39,30 +39,22 @@
 			</scroll-view>
 			<view class="add-btn" @click="addAddress('add')" :style="{bottom :isIphoneX ? '68rpx' : '34rpx'}">添加新地址</view>
 		</view>
-		<!-- 删除弹窗 -->
-		<model-alert v-if="isShowDelModal"
-					 :alertText='alertText' 
-					 @btnConfirm ='confirmDetele'>
-		</model-alert>
 	</view>
 </template>
 
 <script>
 	import authorize from '@/common/config/authorize.js'	
-	import modelAlert from '@/components/cm-module/modelAlert/modelAlert.vue'
 	export default {
-		components:{
-			modelAlert
-		},
 		data() {
 			return {
 				isIphoneX:this.$store.state.isIphoneX,
 				isSelect:false,
 				isEmpty:false,
-				isLoadMore:false,
-				userID:'',
-				pageNum:1,
-				pageSize:10,
+				listQuery:{
+					userId:0,
+					pageNum:1,
+					pageSize:10
+				},
 				addressList: [],
 				hasNextPage:false,
 				allowDataStatus:true,
@@ -76,11 +68,6 @@
 			if(option.type=='select'){this.isSelect = true;}
 			this.setScrollHeight();
 		},
-		onReachBottom() {
-			if(this.isLoadMore) {
-				this.initAddressList();
-			}
-		},
 		methods: {
 			setScrollHeight() {	// 窗口高度 - 底部距离
 				setTimeout(()=> {
@@ -95,27 +82,33 @@
 					})
 				}, 500)
 			},
-			initAddressList(){	
-				let params = {pageNum:this.pageNum,pageSize:this.pageSize,userID:this.userID}
-				this.UserService.QueryAddressList(params).then(response =>{
-					if(response.data.results == ''){
-						this.isEmpty = true
-					}else{
+			getQueryAddressList(){	//初始化地址列表数据
+				this.UserService.QueryAddressList(this.listQuery).then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
 						this.isEmpty = false
-						let results =[];
-						results = response.data.results;
-						this.addressList = this.addressList.concat(results);
-						this.pageNum = response.index +1;
-						if(this.pageNum === response.totalPage + 1 ){
-							this.isLoadMore = false;
-						} else {
-							this.isLoadMore = true;
-						}
+						this.hasNextPage = data.hasNextPage
+						this.addressList = data.list
+					}else{
+						this.isEmpty = true
 					}
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			getOnReachBottomData(){// 上滑加载分页
+				this.listQuery.pageNum+=1
+				this.UserService.QueryAddressList(this.listQuery).then(response =>{
+					let data = response.data
+					if(data.list&&data.list.length > 0){
+						this.hasNextPage = data.hasNextPage
+						this.addressList = this.addressList.concat(data.list) 
+					}
+				})
+				.catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
 			checkAddress(item){//选择地址
 				//是否需要返回地址(从订单确认页跳过来选收货地址)
 				if(!this.isSelect){return ;}
@@ -130,32 +123,32 @@
 					url: `/pages/user/address/addressManage?type=${type}&data=${JSON.stringify(item)}`
 				})
 			},
-			deleteAddress(id){//删除收货地址
+			deleteAddress(addressId){//删除收货地址
 				this.$util.modal('','确定要删除该地址?','确定','取消',true,() =>{
-					this.UserService.DeleteNewAddress({addressID:id,userID:this.userID}).then(response =>{
+					this.UserService.DeleteAddress({addressId:addressId,userId:this.listQuery.userId}).then(response =>{
 						this.$util.msg('删除成功',2000,true,'success')
 						setTimeout(() =>{
-							this.pageNum = 1;
+							this.listQuery.pageNum = 1;
 							this.addressList = [];
-							this.initAddressList();
+							this.getQueryAddressList();
 						},2000)
 					}).catch(error =>{
 						this.$util.msg(error.msg,2000);
-						setTimeout(function(){
-							uni.switchTab({
-								url:'/pages/tabBar/home/index'
-							})
-						},1000)
 					})
 				})
 			}
 		},
+		onReachBottom() {
+			if(this.hasNextPage) {
+				this.getOnReachBottomData();
+			}
+		},
 		onShow() {
 			this.$api.getStorage().then((resolve) =>{
-				this.userID = resolve.userId ? resolve.userId : 0
-				this.pageNum = 1;
+				this.listQuery.userId = resolve.userId ? resolve.userId : 0
+				this.listQuery.pageNum = 1;
 				this.addressList = [];
-				this.initAddressList();
+				this.getQueryAddressList();
 				var pages = getCurrentPages();
 				var prevPage = pages[pages.length - 2];  //上一个页面	
 					// prevPage.setData({select:''})

+ 22 - 21
pages/user/address/addressManage.vue

@@ -3,7 +3,7 @@
 		<view class="add-content">
 			<view class="input-row b-b">
 				<view class="label">收货人:</view>
-				<input class="input" type="text" v-model="addressData.shouHuoRen" @input="onShouHuoRen" placeholder="请输入收货人姓名" placeholder-class="placeholder" />
+				<input class="input" type="text" v-model="addressData.receiver" @input="onShouHuoRen" placeholder="请输入收货人姓名" placeholder-class="placeholder" />
 			</view>
 			<view class="input-row b-b">
 				<view class="label">手机号:</view>
@@ -17,7 +17,9 @@
 				<text class="iconfont icon-xiayibu"></text>
 			</view>
 			<view class="text-textarea b-b"> 
-				<view class="textarea show" v-if="isShowInput">{{addressData.address ?addressData.address :'详细地址:如道路、门牌号、小区、楼房号、单元室等'}}</view>
+				<view class="textarea show" v-if="isShowInput">
+					{{addressData.address ? addressData.address :'详细地址:如道路、门牌号、小区、楼房号、单元室等'}}
+				</view>
 				<textarea 	v-else
 							class="textarea" 
 							type="text" 
@@ -60,12 +62,12 @@
 				isShowInput:false,
 				switchDefault:false,
 				addressData:{
-					addressID:'',
+					addressId:'',
 					allAddress:'请选择收货地区',
-					userID: '',			//用户id ,只在新增收货地址时传
-					shouHuoRen: '',		//收货人
+					userId: '',			//用户id ,只在新增收货地址时传
+					receiver: '',		//收货人
 					mobile:'',			//收货人手机
-					townID:'',			//区ID
+					townId:'',			//区ID
 					address: '',	//地址
 					defaultFlag:0,		//是否默认收货地址(0 不是默认,1 默认)
 				},
@@ -82,13 +84,12 @@
 				this.addressData.allAddress = `${optionData.province}-${optionData.city}-${optionData.town}`
 				this.addressData.address = optionData.address?optionData.address:''
 				this.addressData.defaultFlag = optionData.defaultFlag;
-				this.addressData.userID = optionData.userID;
+				this.addressData.userId = optionData.userId;
 				this.addressData.mobile = optionData.mobile;
-				this.addressData.townID = optionData.townID;
-				this.addressData.addressID = optionData.addressID;
-				this.addressData.shouHuoRen = optionData.shouHuoRen;
-				this.addressData.addressID = optionData.addressID;
-				if(this.addressData.defaultFlag =='1'){
+				this.addressData.townId = optionData.townId;
+				this.addressData.addressId = optionData.addressId;
+				this.addressData.receiver = optionData.receiver;
+				if(this.addressData.defaultFlag == 1){
 					this.switchDefault = true
 				}else{
 					this.switchDefault = false
@@ -114,13 +115,13 @@
 			onConfirm(e) {
 				console.log(e)
 				this.addressData.allAddress = e.name;
-				this.addressData.townID = e.townCode;	
+				this.addressData.townId = e.townCode;	
 				this.initInput();
 			},			
 			//提交
 			confirm(){
 				let data = this.addressData;
-				if(!data.shouHuoRen){
+				if(!data.receiver){
 					this.$util.msg('请填写收货人');
 				}
 				if(data.address =='所在地区'){
@@ -132,9 +133,9 @@
 				}
 				if(this.addType ==1){
 					this.params ={
-							userID:data.userID  ,		//用户id ,只在新增收货地址时传
-							shouHuoRen:data.shouHuoRen ,//收货人
-							townID:data.townID,			//区ID
+							userId:data.userId  ,		//用户id ,只在新增收货地址时传
+							receiver:data.receiver ,//收货人
+							townId:data.townId,			//区ID
 							address:data.address,//地址
 							mobile:data.mobile,			//手机
 							defaultFlag:data.defaultFlag//是否默认收货地址(0 不是默认,1 默认)
@@ -147,7 +148,7 @@
 			},
 			postAddressData(params){
 				this.btnText(true)
-				this.UserService.AddNewAddress(params).then( response=>{
+				this.UserService.AddressSave(params).then( response=>{
 					this.$util.msg('保存成功',1500,true,'success')
 					this.btnText(false)
 					setTimeout(()=>{
@@ -168,7 +169,7 @@
 				}
 			},
 			onShouHuoRen(e){
-			   this.addressData.shouHuoRen = e.detail.value;
+			   this.addressData.receiver = e.detail.value;
 			   this.initInput();
 			},
 			onMobile(e){
@@ -180,7 +181,7 @@
 			   this.initInput();
 			},
 			initInput(){
-				if(this.addressData.shouHuoRen !== "" && this.addressData.mobile !=="" && this.addressData.address !=="" && this.addressData.townID!==""){
+				if(this.addressData.receiver !== "" && this.addressData.mobile !=="" && this.addressData.address !=="" && this.addressData.townId!==""){
 					this.isConfirm =false;
 				}else{
 					this.isConfirm =true;
@@ -189,7 +190,7 @@
 		},
 		onShow() {
 			this.$api.getStorage().then((resolve) =>{
-				this.addressData.userID = resolve.userId ? resolve.userId : 0
+				this.addressData.userId = resolve.userId ? resolve.userId : 0
 			})
 		}
 	}

+ 1 - 1
services/ajax.env.js

@@ -11,5 +11,5 @@ if(process.env.NODE_ENV === 'development'){
     // 生产环境
 	// URL_CONFIG = 'https://spi-b.caimei365.com'
     URL_CONFIG = 'https://spi.caimei365.com'
-}
+} 
 export default URL_CONFIG

+ 1 - 1
services/config.env.js

@@ -5,7 +5,7 @@ if(process.env.NODE_ENV === 'development'){
 	// URL_CONFIG = 'http://192.168.2.67:18002'	 //裴裴联调地址
 	URL_CONFIG = 'https://core-b.caimei365.com'
 	// URL_CONFIG = 'https://core.caimei365.com'
-}else{
+}else{ 
     // 生产环境
 	// URL_CONFIG = 'https://core-b.caimei365.com'
 	URL_CONFIG = 'https://core.caimei365.com'

+ 12 - 2
services/product.service.js

@@ -113,7 +113,12 @@ export default class ProductService {
 	 * @param:productCount 商品数量(必填)
 	 */
 	shoppingAddCart (data = {}) {
-		return this.AjaxService.post({ url:'/shoppingCart/addCart', data, isLoading: true })
+		return this.AjaxService.post({ 
+			url:'/order/club/cart/add', 
+			data, 
+			isLoading: true ,
+			isHost:true
+		})
 	}
 	/**
 	 * @查询购物车数量
@@ -132,7 +137,12 @@ export default class ProductService {
 	 * @param:userId 用户ID(必填)
 	 */
 	QueryShoppingCartList (data = {}) {
-		return this.AjaxService.get({ url:'/shoppingCart/list', data, isLoading: false })
+		return this.AjaxService.get({ 
+			url:'/order/club/cart/list', 
+			data, 
+			isLoading: false ,
+			isHost:true
+		})
 	}
 	
 	/**

+ 2 - 1
services/public.service.js

@@ -11,9 +11,10 @@ export default class PublicService {
 	 */
 	GetAllAddressData (data = {}) {
 		return this.AjaxService.get({ 
-			url:'/club/address', 
+			url:'/order/address/select/all', 
 			data, 
 			isLoading: false ,
+			isHost:true
 		})
 	}
 	/**

+ 9 - 6
services/user.service.js

@@ -181,9 +181,10 @@ export default class UserService {
 	 */
 	QueryAddressList (data = {}) {
 		return this.AjaxService.get({ 
-			url:'/personalCenter/findAddress', 
+			url:'/order/address/list', 
 			data, 
 			isLoading: true ,
+			isHost:true
 		})
 	}
 	/**
@@ -191,11 +192,12 @@ export default class UserService {
 	 * @param:userId 用户ID(必传),
 	 * @param:地址信息,
 	 */
-	AddNewAddress (data = {}) {
+	AddressSave (data = {}) {
 		return this.AjaxService.post({ 
-			url:'/personalCenter/saveAddress', 
+			url:'/order/address/save', 
 			data, 
 			isLoading: true ,
+			isHost:true
 		})
 	}
 	/**
@@ -203,11 +205,12 @@ export default class UserService {
 	 * @param:userId 用户ID(必传),
 	 * @param:地址信息,
 	 */
-	DeleteNewAddress (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/personalCenter/deleteAddress', 
+	DeleteAddress (data = {}) {
+		return this.AjaxService.post({ 
+			url:'/order/address/delete', 
 			data, 
 			isLoading: true ,
+			isHost:true
 		})
 	}
 	/**