pengyh 1 år sedan
förälder
incheckning
a8cb9b589b

+ 2 - 1
src/views/auxiliaryFittings/salesManagement/attachmentSalesOrder/index.vue

@@ -15,7 +15,7 @@
 		  </div>
 		</template-page>
 		<div class="detail" v-if="formDialog">
-			<attachmentSalesOrderDetail :id="id" @back="backList" :formType="formDialogType" :title="'辅材销售订单' + formDialogTitles[formDialogType]"></attachmentSalesOrderDetail>
+			<attachmentSalesOrderDetail :id="id" @back="backList" :formType="formDialogType" :title="'配件销售订单' + formDialogTitles[formDialogType]"></attachmentSalesOrderDetail>
 		</div>
 	</div>
 </template>
@@ -76,6 +76,7 @@ export default {
 	  this.$refs.pageRef.refreshList()
 	},
 	backList() {
+		this.id = ''
 		this.formDialog = false;
 		this.$refs.pageRef.refreshList()
 	},

+ 71 - 5
src/views/auxiliaryFittings/salesManagement/components/attachmentSalesOrderDetail.vue

@@ -109,8 +109,8 @@
 								  </el-select>
 							</el-form-item>
 						</el-col>
-						<el-col :span="3" v-if="formData.payType == 'WECHAT'">
-							<div style="height: 32px;display: flex;align-items: center;cursor: pointer;">微信支付<i class="el-icon-full-screen"></i></div>
+						<el-col :span="3" v-if="formData.flag == 'SUBMIT' && formData.payType == 'WECHAT'">
+							<div style="height: 32px;display: flex;align-items: center;cursor: pointer;" @click="wxPay()">微信支付<i class="el-icon-full-screen"></i></div>
 						</el-col>
 						<el-col :span="24">
 							<el-form-item label="备注">
@@ -170,11 +170,25 @@
 				<el-button size="small" type="info" @click="goBack">返回</el-button>
 			</div>
 		</div>
+		<el-dialog title="微信支付" :visible.sync="isPay" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="payCodeUrl = '';clear()">
+			<h3 style="text-align: center;">扫二维码支付</h3>
+		<!-- 			<el-image :src="payCodeUrl" fit="fit"></el-image> -->
+			<div
+			  ref="payQRCode"
+			  style="display: flex; justify-content: center;"
+			/>
+			<div style="color: #EA8000;text-align: center;margin-top: 20px;">注:支付成功后,方可操作确认提货!</div>
+			<div style="display: flex;justify-content: flex-end;margin-top: 30px;">
+				<el-button size="mini" type="text" @click="isPay = false;clear()">取消</el-button>
+				<el-button size="small" type="primary"  @click="isPay = false;getDetail()">确定</el-button>
+			</div>
+		</el-dialog>
 	</div>
 </template>
 
 <script>
 	import { getWebsit } from "@/api/customerManagement";
+	import QRCode from "qrcodejs2";
 	import { getWorker, getCategory, getGoods, getDetail, add, edit, confirm, submit, getCode } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
 	export default {
 		props: ['id','title','formType'],
@@ -183,6 +197,9 @@
 				dataList: [],
 				websitList: [],
 				workerList: [],
+				isPay: false,
+				is_submit: true,
+				payCodeUrl: '',
 				formData: {
 					websit: {},
 					websitId: '',
@@ -200,9 +217,11 @@
 					idcard: '',
 					phone: '',
 					source: '',
-					payType: ''
+					payType: '',
+					remark: ''
 				},
 				isEdit: 0,
+				timer: '',
 				companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
 				rules: {
 					websitId: [
@@ -280,7 +299,6 @@
 				this.formData.websitId = e.websitId
 				this.formData.websitName = e.name
 				this.getWorker()
-				this.getGoods()
 			},
 			async getGoods(goodsName,type){
 				const that = this
@@ -341,6 +359,7 @@
 					qty: '',
 					goodsType: 'P'
 				})
+				this.getGoods()
 			},
 			submit(){
 				this.$confirm(`请确定是否提交订单, 是否继续?`, '提示', {
@@ -353,7 +372,11 @@
 					}).then(res => {
 						if(res.code == 200){
 							this.$message.success('提交成功!')
-							this.goBack()
+							if(this.formData.payType == 'WECHAT'){
+								this.wxPay()
+							}else{
+								this.goBack()
+							}
 						}
 					})
 				});
@@ -374,6 +397,49 @@
 					})
 				});
 			},
+			checkPay(){
+				this.timer = setInterval(()=>{
+					getDetail({salesId: this.id}).then(res => {
+						if(res.data.payFlag == 'YES'){
+							this.clear()
+							this.$message.success('支付成功!')
+							this.goBack()
+						}
+					})
+				},3000)
+			},
+			clear(){
+				clearInterval(this.timer)
+			},
+			wxPay(){
+				if(!this.is_submit){
+					return false
+				}
+				this.is_submit = false
+				setTimeout(()=>{
+					this.is_submit = true
+				},3000)
+				getCode({
+					salesId: this.formData.salesId
+				}).then(res => {
+					if(res.code == 200){
+						this.payCodeUrl = res.data.codeUrl
+						this.isPay = true
+						this.$nextTick(() => {
+						  this.payUrl = res.data.codeUrl;
+						  new QRCode(this.$refs.payQRCode, {
+						    text: res.data.codeUrl,
+						    width: 200,
+						    height: 200,
+						    colorDark: "#333333", // 二维码颜色
+						    colorLight: "#ffffff", // 二维码背景色
+						    correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
+						  });
+						  this.checkPay()
+						});
+					}
+				})
+			},
 			save(){
 				this.$refs.formData.validate((valid, invalidFields, errLabels) => {
 					if (valid) {

+ 21 - 4
src/views/auxiliaryFittings/salesManagement/components/auxiliarySalesOrderDetail.vue

@@ -109,7 +109,7 @@
 								  </el-select>
 							</el-form-item>
 						</el-col>
-						<el-col :span="3" v-if="formData.payType == 'WECHAT'">
+						<el-col :span="3" v-if="formData.flag == 'SUBMIT' && formData.payType == 'WECHAT'">
 							<div style="height: 32px;display: flex;align-items: center;cursor: pointer;" @click="wxPay()">微信支付<i class="el-icon-full-screen"></i></div>
 						</el-col>
 						<el-col :span="24">
@@ -195,7 +195,7 @@
 				<el-button size="small" type="info" @click="goBack">返回</el-button>
 			</div>
 		</div>
-		<el-dialog title="微信支付" :visible.sync="isPay" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="payCodeUrl = ''">
+		<el-dialog title="微信支付" :visible.sync="isPay" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="payCodeUrl = '';clear()">
 			<h3 style="text-align: center;">扫二维码支付</h3>
 <!-- 			<el-image :src="payCodeUrl" fit="fit"></el-image> -->
 			<div
@@ -204,7 +204,7 @@
 			/>
 			<div style="color: #EA8000;text-align: center;margin-top: 20px;">注:支付成功后,方可操作确认提货!</div>
 			<div style="display: flex;justify-content: flex-end;margin-top: 30px;">
-				<el-button size="mini" type="text" @click="isPay = false">取消</el-button>
+				<el-button size="mini" type="text" @click="isPay = false;clear()">取消</el-button>
 				<el-button size="small" type="primary"  @click="isPay = false;getDetail()">确定</el-button>
 			</div>
 		</el-dialog>
@@ -242,10 +242,12 @@
 					idcard: '',
 					phone: '',
 					source: '',
-					payType: ''
+					payType: '',
+					remark: ''
 				},
 				isEdit: 0,
 				is_submit: true,
+				timer: '',
 				companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
 				rules: {
 					websitId: [
@@ -469,6 +471,20 @@
 					})
 				});
 			},
+			checkPay(){
+				this.timer = setInterval(()=>{
+					getDetail({salesId: this.id}).then(res => {
+						if(res.data.payFlag == 'YES'){
+							this.clear()
+							this.$message.success('支付成功!')
+							this.goBack()
+						}
+					})
+				},3000)
+			},
+			clear(){
+				clearInterval(this.timer)
+			},
 			wxPay(){
 				if(!this.is_submit){
 					return false
@@ -493,6 +509,7 @@
 						    colorLight: "#ffffff", // 二维码背景色
 						    correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
 						  });
+						  this.checkPay()
 						});
 					}
 				})