lilei 7 months ago
parent
commit
558c816fd5

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.113:9110/saas/clz/', // 本地
+			// baseUrl: 'http://192.168.2.10:7002/saas/clz/', // 本地
 			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 8 - 0
api/purchase.js

@@ -47,4 +47,12 @@ export const purchaseReceive = params => {
     method: 'post',
     data: params
   })
+}
+// 支付接口
+export const purchasePay = params => {
+  return request({
+    url: `payInfo/toPay`,
+    method: 'post',
+    data: params
+  })
 }

+ 20 - 2
pagesB/components/payModal.vue

@@ -53,6 +53,12 @@
 					return null
 				}
 			},
+			payData: {
+				type: Object,
+				default: ()=>{
+					return null
+				}
+			},
 			cancelPayMessage: {
 				type: String,
 				default: '您的订单在30分钟内未支付将被取消,请尽快完成支付。'
@@ -136,8 +142,20 @@
 			},
 			// 确认付款
 			confirmPay(){
-				this.showModal = false
-				this.submitOk = true
+				const _this = this
+				// uni.showLoading({
+				// 	title: '正在支付...',
+				// 	mask: true
+				// })
+				// 确认付款
+				const data = _this.payData
+				uni.showToast({
+					mask: true,
+					title: data ? '支付成功' : '支付失败',
+					icon: 'none'
+				})
+				_this.showModal = false
+				_this.submitOk = data
 			},
 		}
 	}

+ 20 - 4
pagesB/procureOrder/creatOrder.vue

@@ -75,7 +75,7 @@
 				</view>
 		</view>
 		<!-- 付款弹框 -->
-		<payModal :showPopu="showPopu" :closeCurPage="true" :payInfo="payInfo" @close="showPopu=false" @payComplete="toOrderDetial"></payModal> 
+		<payModal :showPopu="showPopu" :closeCurPage="true" :payInfo="payInfo" :payData="payData" @close="showPopu=false" @payComplete="toOrderDetial"></payModal> 
 	</view>
 </template>
 
@@ -87,7 +87,7 @@
 	import productItem from '@/pagesB/cart/productitem.vue'
 	import sklineHeader from '../../components/skline/sklineHeader.vue'
 	import payModal from '../components/payModal.vue'
-	import { purchaseSave, purchaseCheck } from '@/api/purchase.js'
+	import { purchaseSave, purchaseCheck, purchasePay } from '@/api/purchase.js'
 	export default {
 		components:{
 			productItem,
@@ -127,7 +127,7 @@
 				statusBarHeight: 44, // 状态栏高度
 				safeAreaBottom: 0, // 底部安全区域高度
 				showPopu: false, // 弹框
-				hasPay: true ,// 是否开通支付
+				payData: null // 付款参数
 			}
 		},
 		computed: {
@@ -139,6 +139,15 @@
 			settleAmount(){
 				return Number(this.totalAmount-this.totalDiscount-this.totalCoupon).toFixed(2).toString().split('.')
 			},
+			// 货架经销商信息
+			shelfInfo(){
+				return this.$store.state.vuex_storeShelf
+			},
+			//是否开启线上支付
+			hasPay(){
+				const shelfInfo = this.shelfInfo
+				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'
+			},
 			// 付款信息
 			payInfo(){
 				return this.$store.state.vuex_tempOrderData
@@ -258,7 +267,14 @@
 						this.$store.state.vuex_tempOrderData = res.data
 						// 这里判断是否开通支付,如果开通打开确认付款弹框
 						if(this.hasPay){
-							this.showPopu = true
+							purchasePay({
+								bizSn:res.data.purchaseSn,
+								bizNo:res.data.purchaseNo,
+								bizType:'PURCHASE',
+							}).then(res=>{
+								this.showPopu = true
+								this.payData = res.data
+							})
 						}else{
 							// 创建成功,跳转到订单详情页
 							this.toOrderDetial()

+ 36 - 4
pagesB/procureOrder/orderDetail.vue

@@ -119,16 +119,48 @@
 					<text>下单人员</text>
 					<text>{{info.purchaserName || '--'}}</text>
 				</view>
-				<view class="infoList">
+				<!-- 线下支付正常显示 -->
+				<view class="infoList" v-if="info&&info.payOnlineFlag&&info.payOnlineFlag==0">
 					<text>付款时间</text>
 					<text>{{info.purchaseDate||'--'}}</text>
 				</view>
+				<!-- 线上支付 显示 -->
+				<view v-if="info&&info.payOnlineFlag==1&&info.payInfo">>
+					<view class="infoList">
+						<text>支付方式</text>
+						<text>{{info.payInfo.payWay||'--'}}</text>
+					</view>
+					<view class="infoList">
+						<text>支付时间</text>
+						<text>{{info.payInfo.payDate||'--'}}</text>
+					</view>
+					<view class="infoList" v-if="info&&info.billStatus != 'WAIT_AUDIT'&&info.billStatus != 'WAIT_PAY'">
+						<text>审核时间</text>
+						<text>{{info.payInfo.purchaseDate||'--'}}</text>
+					</view>
+					<view class="infoList">
+						<text>退款方式</text>
+						<text>{{info.payInfo.refundWay ||'--'}}</text>
+					</view>
+					<view class="infoList">
+						<text>退款时间</text>
+						<text>{{info.payInfo.refundDate ||'--'}}</text>
+					</view>
+					<view class="infoList" v-if="info&&info.billStatus === 'CANCEL'">
+						<text>取消时间</text>
+						<text>{{info.purchaseDate||'--'}}</text>
+					</view>
+					<view class="infoList" v-if="info&&(info.billStatus === 'CANCEL'||info.billStatus === 'WAIT_AUDIT'||info.billStatus == 'WAIT_PAY')">
+						<text>配送汽配商</text>
+						<text>{{info.purchaseDate||'--'}}</text>
+					</view>
+				</view>
 			</view>
 		</view>
 		<view v-if="info&&info.billStatus == 'WAIT_AUDIT'||info.billStatus == 'WAIT_PAY'||info.billStatus == 'WAIT_RECEIVE'" style="background-color: #fff;">
 			<view class="footer flex align_center justify_center">
 				<u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="default" plain @click="cancelOrder(info)">取消订单</u-button>
-				<u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="error" plain @click="payOrder(info)">立即支付</u-button>
+				<u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_PAY'" size="mini" shape="round" type="error" plain @click="payOrder(info)">立即支付</u-button>
 				<!-- <u-button style="margin-left: 10px;" v-if="info.billStatus == 'FINISH'" size="mini" shape="round" type="error" plain @click="buyAgain(info)">再次购买</u-button> -->
 				<u-button style="margin-left: 10px;" v-if="info.billStatus == 'WAIT_RECEIVE'" size="mini" shape="round" type="error" plain @click="receiveOrder(info)">确认收货</u-button>
 			</view>
@@ -169,7 +201,7 @@
 		   uni.setNavigationBarTitle({
 		   	title: '采购订单详情'
 		   })
-		  const data = this.$store.state.vuex_tempOrderData
+		  const data = this.$store.state.vuex_tempOrderData //获取订单信息
 		  if(data){
 			  this.info = data
 			  this.state = data.billStatus
@@ -267,7 +299,7 @@
 		 payComplete(item,isOk){
 		 	this.showPopu = false
 		 	if(isOk){
-		 		uni.$emit('refreshPurcaOrder',item,'WAIT_AUDIT')
+		 		uni.$emit('refreshPurcaOrder',item,'payOk')
 				uni.navigateBack()
 		 	}
 		 },

+ 32 - 16
pagesB/procureOrder/orderList.vue

@@ -17,10 +17,10 @@
 								<view class="check-row align_center justify_between">
 									<view class="orderNo">{{item.purchaseNo}}</view>
 									<view class="times">
-										<span v-if="item.billStatus == 'WAIT_AUDIT'">待审核</span>
-										<view v-if="item.billStatus == 'WAIT_AUDIT'" class="waitPay">
+										<span v-if="item.billStatus == 'WAIT_AUDIT'&&item.payOnlineFlag==0">待审核</span>
+										<view v-if="item.billStatus == 'WAIT_PAY'" class="waitPay">
 											<text>待付款</text>
-											<text>22小时11分钟</text>
+											<u-count-down :timestamp="item.timestamp" :show-days="false" :show-hours="false"></u-count-down>
 										</view>
 										<span v-if="item.billStatus == 'AUDIT_REJECT'">审核不通过</span>
 										<span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE' || item.billStatus == 'WAIT_RECEIVE'">待收货</span>
@@ -31,18 +31,18 @@
 								 <view class="check-row">
 									 <view v-if="item.totalCategory>1" class="check-row-left">
 										 <scroll-view style="width: 100%;white-space: nowrap;" scroll-x="true">
-											 <view class="img-item" v-for="item in item.totalCategory" :key="item">
-											 	 <image src="/static/def_imgs.png" style="width: 100%;height: 100%;"></image>
+											 <view class="img-item" v-for="item in item.productList" :key="item.id">
+											 	 <image :src="item.images||'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
 											 </view>
 										 </scroll-view>
 									 </view>
 									 <view v-else class="check-row-left">
 										 <view class="img-item">
-										 	 <image src="/static/def_imgs.png" style="width: 100%;height: 100%;"></image>
+										 	 <image :src="item.productList&&item.productList[0].images||'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
 										 </view>
 										 <view class="product-info">
-											<text class="ellipsis-two">布瑞斯免维护蓄电池 五菱之光,五菱荣光</text>
-											<text class="ellipsis-one">58-500MF</text>
+											<text class="ellipsis-two">{{item.productList&&item.productList[0].productName ||'--'}}</text>
+											<text class="ellipsis-one">{{item.productList&&item.productList[0].origCode||'--'}}</text>
 										 </view>
 									 </view>
 									 <view :class="item.totalCategory>1?'check-row-right check-row-right-fixed':'check-row-right'">
@@ -56,7 +56,7 @@
 									 </view>
 									 <view style="text-align: right;color: #999;">
 										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="default" plain @click="cancelOrder(item)">取消订单</u-button>
-										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="error" plain @click="payOrder(item)">立即支付</u-button>
+										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_PAY'" size="mini" shape="round" type="error" plain @click="payOrder(item)">立即支付</u-button>
 										 <!-- <u-button style="margin-left: 10px;" v-if="item.billStatus == 'CANCEL'" size="mini" shape="round" type="error" plain @click="buyAgain(item)">再次购买</u-button> -->
 										 <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_RECEIVE'" size="mini" shape="round" type="error" plain @click="receiveOrder(item)">确认收货</u-button>
 									 </view>
@@ -137,8 +137,8 @@
 		onLoad() {
 			let _this = this
 			_this.pageInit()
-			uni.$on('refreshPurcaOrder',function(data){
-				 _this.resetList(data)
+			uni.$on('refreshPurcaOrder',function(data, state){
+				 _this.resetList(data,state)
 			})
 		},
 		methods:{
@@ -238,6 +238,7 @@
 			payComplete(item,isOk){
 				this.showPopu = false
 				if(isOk){
+					item.payOnlineFlag = 0
 					this.viewRow(item)
 					setTimeout(()=>{
 						this.resetList(item,'WAIT_AUDIT')
@@ -281,7 +282,7 @@
 			  // 状态条件
 			  // 待付款
 			  if(this.swiperCurrent == 1){
-			  	  params.billStatusList = ['WAIT_PAY']
+				 params.billStatusList = ['WAIT_AUDIT']
 			  }
 			  // 待收货
 			  if(this.swiperCurrent == 2){
@@ -302,16 +303,31 @@
 			  this.status = "loading"
 			  purchaseQueryPage(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
+				  let list = res.data.list || []
+				  list.map(item => {
+					  let now = new Date(item.purchaseDate)
+					  now.setMilliseconds(now.getMilliseconds() + 30 * 60 * 1000)
+					  item.timestamp = now.getTime()
+					  item.billStatus = item.billStatus == 'WAIT_AUDIT'&&item.payOnlineFlag==1&&item.payInfo&&item.payInfo.payState=='WAIT'?'WAIT_PAY':item.billStatus
+				  })
+				  // 待收款
+				  if(_this.swiperCurrent==1){
+					  list = list.filter(item => {
+						  return item.billStatus == 'WAIT_PAY'
+					  })
+				  }
 				  if(_this.pageNo>1){
-					  _this.list = _this.list.concat(res.data.list || [])
+					  _this.list = _this.list.concat(list)
 				  }else{
-					  _this.list = res.data.list || []
+					  _this.list = list
 				  }
+				  
 				  _this.total = res.data.count || 0
 				  // 待收货
-				  if(_this.swiperCurrent == 1){
-					  _this.tabList[1].count = _this.total
+				  if(_this.swiperCurrent == 2){
+					  _this.tabList[2].count = _this.total
 				  }
+				  
 				} else {
 				  _this.list = []
 				  _this.total = 0

+ 32 - 7
pagesB/shopiing/productDetail.vue

@@ -235,7 +235,7 @@
 	} from 'vuex'
 	import { addCart, getCartCount } from '@/api/cart.js'
 	import { getShopDetail } from '@/api/shop.js'
-	import { purchaseSave, purchaseCheck } from '@/api/purchase.js'
+	import { purchaseSave, purchaseCheck, purchasePay } from '@/api/purchase.js'
 	import { toAuthStore, toLogin } from "@/utils/index.js"
 	export default {
 		data() {
@@ -257,8 +257,8 @@
 				cacelOk: false, // 是否取消
 				refashOk: false, // 是否刷新页面
 				showPay: false, // 是否显示付款信息
-				hasPay: true ,// 是否开通支付
 				isAddCart: false, // 是否加入购物车
+				payData: null, // 支付参数
 			}
 		},
 		onLoad(option) {
@@ -289,6 +289,11 @@
 			shelfInfo(){
 				return this.$store.state.vuex_storeShelf
 			},
+			//是否开启线上支付
+			hasPay(){
+				const shelfInfo = this.shelfInfo
+				return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'
+			},
 			// 经销商电话
 			dealerPhone(){
 				const shelfInfo = this.shelfInfo
@@ -554,13 +559,21 @@
 						this.$store.state.vuex_tempOrderData = res.data
 						// 打开确认付款弹框,这里判断是否开通支付,如果开通
 						if(this.hasPay){
-							this.showPay = true
+							purchasePay({
+								bizSn:res.data.purchaseSn,
+								bizNo:res.data.purchaseNo,
+								bizType:'PURCHASE',
+							}).then(res=>{
+								this.showPay = true
+								this.payData = res.data
+								uni.hideLoading()
+							})
 						}else{
 							// 创建成功,跳转到订单详情页
 							this.showPopu = false
 							this.submitOk = true
+							uni.hideLoading()
 						}
-						uni.hideLoading()
 					}else{
 						uni.hideLoading()
 						uni.showToast({
@@ -573,7 +586,7 @@
 			// 关闭之前
 			beforeClosePopu(){
 				// 正在支付
-				if(this.showPay){
+				if(this.showPay&&!this.submitOk){
 					this.showPay = false
 					this.cancelPay()
 				}
@@ -619,8 +632,20 @@
 			},
 			// 确认付款
 			confirmPay(){
-				this.showPopu = false
-				this.submitOk = true
+				const _this = this
+				// uni.showLoading({
+				// 	title: '正在支付...',
+				// 	mask: true
+				// })
+				// 确认付款
+				const data = _this.payData
+				uni.showToast({
+					mask: true,
+					title: data ? '支付成功' : '支付失败',
+					icon: 'none'
+				})
+				_this.showPopu = false
+				_this.submitOk = true
 			},
 			// 确认取消付款弹框
 			cancelPay(){