Browse Source

修改机构订单结算,分享商品,优化部分问题

zhengjinyi 5 years ago
parent
commit
3e843be6bf

+ 2 - 2
common/config/config.js

@@ -2,9 +2,9 @@ let URL_CONFIG = ""
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
 	// URL_CONFIG = 'http://192.168.1.22:8008'	 //裴裴联调地址
-	URL_CONFIG = 'http://192.168.1.26:8008'	 //超超联调地址
+	// URL_CONFIG = 'http://192.168.1.26:8008'	 //超超联调地址
 	// URL_CONFIG = 'http://192.168.1.24:8008'	 //俊俊联调地址
-    // URL_CONFIG = 'https://spi-b.caimei365.com'//采美测试地址
+    URL_CONFIG = 'https://spi-b.caimei365.com'//采美测试地址
 }else{
     // 生产环境
     URL_CONFIG = 'https://spi.caimei365.com'

+ 23 - 0
common/config/wxLogin.js

@@ -0,0 +1,23 @@
+import store from '@/store/index.js'
+import authorize from '@/common/config/authorize.js'
+import { userInfoLogin } from "@/api/use.js"
+// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+const wxLoginAuthorize = function(){
+	authorize.getCode('weixin').then(wechatcode =>{
+		userInfoLogin({code:wechatcode}).then(response =>{
+			store.commit('updateStatus',response.data)
+			store.commit('login',response.data);
+			uni.setStorageSync('token',response.data.token)
+			uni.removeStorageSync('sessionid')
+			uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
+		}).catch(response =>{
+			uni.removeStorageSync('sessionid')
+			uni.setStorageSync('sessionid','JSESSIONID='+response.data)
+			store.commit('logout',response.data)
+			store.commit('updateStatus',response.data)
+		})
+	})
+}
+export default{
+	wxLoginAuthorize
+}

+ 0 - 1
components/module/creatOrder/invoiceTent.vue

@@ -49,7 +49,6 @@
 							<input class="form-input" 
 								   type="text" 
 								   v-model="invoiceData.bankAccountNo" 
-								   @input="invoiceData.bankAccountNo" 
 								   placeholder="请填写银行账号(必填)" 
 								   maxlength="25">
 						</view>

+ 0 - 1
components/module/creatOrder/sellerInvoice.vue

@@ -49,7 +49,6 @@
 							<input class="form-input" 
 								   type="text" 
 								   v-model="invoiceData.bankAccountNo" 
-								   @input="invoiceData.bankAccountNo" 
 								   placeholder="请填写银行账号(必填)" 
 								   maxlength="25">
 						</view>

+ 5 - 3
pages/goods/product.vue

@@ -211,6 +211,7 @@
 	import supplierDetails from "@/components/module/productDetails/supplierDetails" //供应商详情
 	import recommend from "@/components/module/productDetails/recommend" //供应商详情
 	import evaluate from "@/components/module/productDetails/evaluate" //供应商详情
+	import wxLogin from "@/common/config/wxLogin.js"
 	import { queryProductDetils } from "@/api/product.js" 
 	import { shoppingAddCart } from "@/api/cart.js" 
 
@@ -282,6 +283,9 @@
 			if(option.page == 2){
 				this.backPage = option.page
 			}
+			if(this.isShareType =='share'){
+				wxLogin.wxLoginAuthorize()
+			}
 		},
 		computed: {
 			...mapState(['hasLogin','userInfo'])
@@ -303,9 +307,7 @@
 						this.productImage.push(item.image);
 					})
 					//购物车数量
-					if(this.product.productCount>0){
-						this.goodsData.cartCount = this.product.productCount
-					}
+					this.goodsData.cartCount = this.product.productCount
 					//处理阶梯价格
 					if(this.product.ladderPriceList!=null){
 						this.ladderPriceList = this.product.ladderPriceList;

+ 3 - 3
pages/login/information.vue

@@ -363,11 +363,11 @@
 					organizationUpdateModifyInfo({userID:this.userID}).then(response =>{
 						let organizationClub = response.data.club
 						let organizationUser = response.data.user
-						this.email = organizationUser.email	
+						this.email = organizationUser.email ? organizationUser.email :''	
 						this.clubID = organizationUser.clubID
-						this.clubName = organizationClub.name
+						this.clubName = organizationClub.name ? organizationClub.name : ''
 						this.clubContact = organizationClub.linkMan1
-						this.mobile = organizationUser.bindMobile
+						this.mobile = organizationUser.bindMobile ? organizationUser.bindMobile : ''
 						this.abbreviation = organizationClub.sname
 						if( organizationClub.provinceID == null ){
 							this.addressData.provinceID = ''

+ 1 - 2
pages/tabBar/home/home.vue

@@ -183,9 +183,8 @@
 				this.hotGoodsList = hotGoodsList;
 			},	
 			getCheekeyCode(){
-				authorize.getCode('weixin').then(wechatcode =>{
+				authorize.getCode('weixin').then(wechatcode =>{// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
 					// console.log(wechatcode);
-					// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
 					userInfoLogin({code:wechatcode}).then(response =>{
 						this.isLogin = true;
 						this.userID = response.data.userID;						

+ 0 - 1
pages/user/operator/addoperator.vue

@@ -101,7 +101,6 @@
 				width: 100%;
 				height: auto;
 				.from-row{
-					width: 100%;
 					height: 40rpx;
 					padding: 24rpx;
 					background: #F7F7F7;

+ 0 - 1
pages/user/operator/list.vue

@@ -366,7 +366,6 @@
 					margin-right: 20rpx;
 					.input{
 						width: 180rpx;
-						padding-left:10rpx;
 						font-size: $font-size-28;
 						color: $text-color;
 						line-height: 40rpx;

+ 89 - 73
pages/user/order/create-order.vue

@@ -9,11 +9,15 @@
 		<!-- 发票信息 -->
 		<invoice-tent ref="invoice" 
 					  v-if="isRequest" 
-					  :invoiceData="invoiceData" 
+					  :invoiceDatas="invoiceData" 
 					  @handleChoiceaInvoice="handleChoiceaInvoiceData">
 		</invoice-tent>
 		<!-- 运费 -->
-		<freight ref="freight" v-if="isRequest" :freightData="freightData" @showFreightAlert="handFreightAlertShow"></freight>
+		<freight ref="freight" 
+				 v-if="isFreight" 
+				 :freightData="freightData" 
+				 @showFreightAlert="handFreightAlertShow">
+		</freight>
 		<freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
 		<!-- 余额抵扣 -->
 		<view class="invoice-balance">
@@ -64,7 +68,7 @@
 	import freightAlert from '@/components/module/modelAlert/freightAlert'
 	import modalLayer from "@/components/modal-layer"
 	import { queryAddressList } from "@/api/cart.js" 
-	import { createOrderInfo,createOrderSubmit,getOrderPostage } from "@/api/order.js" 
+	import { createOrderInfo,createOrderSubmit,getOrderPostage,getFindInvoice,updateInvoice } from "@/api/order.js" 
 	
 	export default {
 		components:{
@@ -95,6 +99,7 @@
 				addressID:'',			  //地址ID
 				townID:'',				  //区ID
 				isRequest:false,		  //是否加载完成渲染子组件
+				isFreight:false,		  //是否加载完成渲染子组件
 				isAddress:false,		  //是否加载完成地址
 				isfreightTip:false,		  //控制邮费弹窗
 				ischecked:false,	      //是否勾选余额
@@ -109,72 +114,64 @@
 		},
 		onLoad(option){//商品数据
 			let data = JSON.parse(option.data);
-			console.log(data)
+			// console.log(data)
 			this.allPrice = data.data.allPrice;
 			this.allCount = data.data.allCount;
 			this.payAllPrice = this.allPrice;
-			// console.log(data)
 			if(option.type =='prodcut'){
 				this.cartType = 2
 				this.productCount = data.data.productCount
 				this.productIds = data.data.productID
-				// this.classifyIDS =  data.data.classifyID
 			}else{
 				this.cartType = 1
 				this.productCount = data.data.productCount
 				this.productIds = data.data.productID
-				// this.classifyIDS =  data.data.classifyID
 			}
-			this.getInitCrearOrder(option);
-			// this.getAddressData()
+			this.$api.getStorage().then((resolve) =>{
+				this.userID = resolve.userID
+				this.getInitCrearOrder(option);
+			})
 		},
 		methods: {
 			getInitCrearOrder(option){//获取订单商品信息
-				this.$api.getStorage().then((resolve) =>{
-					this.userID = resolve.userID
-					let params ={userId:this.userID,count:this.productCount,productIds:this.productIds}
-					createOrderInfo(params).then(response =>{
-						let resData = response.data
-						this.isRequest = true
-						this.goodsData = resData.shopList
-						this.userMoney = resData.userMoney
-						this.getUseFindInvoice()
-					}).catch(response =>{
-						this.$util.msg(response.msg,2000)
-					})
+				let params ={userId:this.userID,count:this.productCount,productIds:this.productIds}
+				createOrderInfo(params).then(response =>{
+					let resData = response.data
+					this.isRequest = true
+					this.goodsData = resData.shopList
+					this.userMoney = resData.userMoney
+					this.getUseFindInvoice()
+				}).catch(response =>{
+					this.$util.msg(response.msg,2000)
 				})
 			},
 			getFreightData(){//获取邮费信息
-				this.$api.getComStorage('orderUserInfo').then((resolve) =>{
-					let params ={
-							userId:resolve.userID,
-							productIds:this.productIds,
-							totalPrice:this.allPrice,
-							townId:this.addressData.townID
-						}
-					getOrderPostage(params).then(response =>{
-						console.log(response)
-						this.isFreight = true
-						this.freightData = response.data
-						if(response.data.freePostFlag== 1){
-							this.payAllPrice = this.payAllPrice+response.data.freight
-						}
-					})	
-				})
+				let params ={
+						userId:this.userID,
+						productIds:this.productIds,
+						totalPrice:this.allPrice,
+						townId:this.addressData.townID
+					}
+				getOrderPostage(params).then(response =>{
+					console.log(response)
+					this.isFreight = true
+					this.freightData = response.data
+					if(response.data.freePostFlag== 1){
+						this.payAllPrice = this.payAllPrice+response.data.freight
+					}
+				})	
 			},
 			getUseFindInvoice(){//获取发票信息
-				this.$api.getComStorage('orderUserInfo').then((resolve) =>{
-					getFindInvoice({userID:resolve.userID}).then(response =>{
-						if(response.data == null){
-							this.invoiceData = Object.assign(this.invoiceData,'',{type:0})
-						}else{
-							this.invoiceData = response.data
-						} 
-					})
+				getFindInvoice({userID:this.userID}).then(response =>{
+					if(response.data == null){
+						this.invoiceData = Object.assign(this.invoiceData,'',{type:0})
+					}else{
+						this.invoiceData = response.data
+					} 
 				})
 			},
 			getAddressData(){//获取地址信息
-				this.$api.getStorage().then((resolve) =>{
+				this.$api.getStorage().then((resolve) => {
 					queryAddressList({pageNum:1,pageSize:1,userID:resolve.userID}).then(response =>{
 						this.isAddress = true
 						this.addressData = {}
@@ -196,35 +193,59 @@
 			handleChoiceaInvoiceData(data){//获取发票信息
 				console.log(data)
 				this.invoiceData = data
-				this.$api.getComStorage('orderUserInfo').then((resolve) =>{
-					let params =Object.assign(data,'',{userID:resolve.userID})
-					updateInvoice(params).then(response =>{
-						console.log(response)
-					})
+				let params =Object.assign(data,'',{userID:this.userID})
+				updateInvoice(params).then(response =>{
+					console.log('<=====保存发票信息成功====>')
 				})
 			},
 			checkedBalabce(){//勾选使用余额
-				if(this.userMoney == 0){
-					return
-				}else{
+				if(this.userMoney > 0){
 					this.ischecked = !this.ischecked
 					if(this.ischecked){
 						this.balanceDeductionFlag =1
-						if(this.userMoney>this.payAllPrice){
-							this.payAllPrice =0.00
-							this.deductMoney = this.allPrice				            //勾选后使用抵余额
-							this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+						this.attributePallPrice()
+					}else{
+						if(this.freightData.freePostFlag == 1 || this.freightData.freePostFlag == '1'){
+							this.payAllPrice = this.allPrice+parseInt(this.freightData.freight)
 						}else{
-							this.payAllPrice = this.allPrice - this.userMoney       	//勾选后的总价
-							this.deductMoney = this.userMoney				            //勾选后使用抵余额
-							this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+							this.payAllPrice = this.allPrice
 						}
-					}else{
-						this.payAllPrice = this.allPrice
 						this.balanceDeductionFlag = 2
 					}
+				}else{
+					return
 				}
 			},	
+			attributePallPrice(){//计算价格
+				if(this.freightData.freePostFlag == 1 || this.freightData.freePostFlag == '1'){
+					this.attributeHashfreight(this.freightData.freight)
+				}else{
+					this.attributeNofreight()
+				}
+			},
+			attributeNofreight(){//计算没有邮费的支付价格
+				if(this.userMoney>this.payAllPrice){
+					this.payAllPrice = 0.00
+					this.deductMoney = this.allPrice							//勾选后使用抵余额
+					this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+				}else{
+					this.payAllPrice = this.allPrice - this.userMoney       	//勾选后的总价
+					this.deductMoney = this.userMoney				            //勾选后使用抵余额
+					this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+				}
+			},
+			attributeHashfreight(freight){//计算需要邮费的支付价格
+				this.payAllPrice = this.allPrice+parseInt(freight)//计算不包邮的价格 总价等于商品价格+邮费
+				if(this.userMoney>this.payAllPrice){							//余额大于支付金额
+					this.payAllPrice =0.00
+					this.deductMoney = this.allPrice+parseInt(freight)			//勾选后使用抵余额
+					this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+				}else{
+					this.payAllPrice = this.allPrice+parseInt(freight) - this.userMoney       	//勾选后的总价
+					this.deductMoney = this.userMoney				            //勾选后使用抵余额
+					this.surplusMoney = this.userMoney - this.deductMoney	    //勾选后的剩余抵扣
+				}
+			},
 			orderSubmitMit(){//提交订单
 				if(this.addressID == ''){
 					this.$util.msg('请先添加收货地址~',2000)
@@ -239,23 +260,18 @@
 							presentNum:0
 						})
 					})
-					if(el.note == null){
-						el.note = ''
-					}else{
-						el.note = el.note
-					}
-					return {shopId:el.shopID,note:el.note,productInfo:productInfo}
+					return {shopId:el.shopID,note:el.note?el.note:'',productInfo:productInfo}
 				})
 				//订单信息
 				this.payInfo = {
 						clauseId:0,//条款(暂时保留)
-						orderShouldPayFee:this.payAllPrice,//提交的总价
+						orderShouldPayFee:this.payAllPrice.toFixed(2),//提交的总价
 						balancePayFlag:this.balanceDeductionFlag,//余额抵扣的状态
-						freight:this.freightData.freight,//邮费
-						freePostFlag:this.freightData.freePostFlag//运费形式
+						freight:this.freightData.freight>0 ? this.freightData.freight : this.freightData.freight.toFixed(2),//邮费
+						freePostFlag:parseInt(this.freightData.freePostFlag)//运费形式
 					}
 				let param = {
-						orderSource:1,
+						orderSource:6,
 						clubUserId:this.userID,
 						cartType:this.cartType,
 						addressId:this.addressID,