From 4fc4068252f1a07e0f42c20ad058a32c87f85a28 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期五, 28 七月 2023 16:24:52 +0800
Subject: [PATCH] 手机号增加校验
---
src/views/sales/refundForm/AddRefundFormDialog.vue | 338 +++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 236 insertions(+), 102 deletions(-)
diff --git a/src/views/sales/refundForm/AddRefundFormDialog.vue b/src/views/sales/refundForm/AddRefundFormDialog.vue
index adfcbc7..0eb0266 100644
--- a/src/views/sales/refundForm/AddRefundFormDialog.vue
+++ b/src/views/sales/refundForm/AddRefundFormDialog.vue
@@ -22,20 +22,29 @@
<div class="basic-info-view">
<el-row>
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О" prop="customName">
+ <el-form-item label="瀹㈡埛鍚嶇О" prop="client_name">
<div class="custom-name">
- <el-input v-model="editConfig.infomation.customName"></el-input>
- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div>
- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div>
+ <el-autocomplete
+ v-model="editConfig.infomation.client_name"
+ :fetch-suggestions="querySearchAsync"
+ value-key="name"
+ @select="handleSelectClient"
+ ></el-autocomplete>
+ <div class="common-select-btn" @click="selClientClick">
+ <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+ </div>
+ <div class="common-select-btn" @click="clearupClient">
+ <i class="el-icon-edit-outline" title="娓呴櫎"></i>
+ </div>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="閫�娆惧崟缂栧彿" prop="refundOrderNo">
- <el-input v-model="editConfig.infomation.refundOrderNo"></el-input>
+ <el-form-item label="閫�娆惧崟缂栧彿" prop="number">
+ <el-input v-model="editConfig.infomation.number"></el-input>
</el-form-item>
</el-col>
- <el-col :span="12">
+ <!-- <el-col :span="12">
<el-form-item label="閫夋嫨婧愬崟" prop="selSourceOrder">
<el-select v-model="editConfig.infomation.selSourceOrder" size="mini" style="width: 63%">
<el-option
@@ -47,21 +56,16 @@
</el-option>
</el-select>
</el-form-item>
- </el-col>
+ </el-col> -->
<el-col :span="12">
- <el-form-item label="閿�鍞礋璐d汉" prop="salesHead">
+ <el-form-item label="閿�鍞礋璐d汉" prop="memberId">
<el-select
- v-model="editConfig.infomation.salesHead"
+ v-model="editConfig.infomation.memberId"
placeholder="璇烽�夋嫨"
size="mini"
style="width: 63%"
>
- <el-option
- v-for="item in salesHeadOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
+ <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
</el-option>
</el-select>
</el-form-item>
@@ -73,38 +77,65 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="浠樻鏂瑰紡" prop="paymentMethod">
- <CommonSelectView
- :common-value="editConfig.infomation.paymentMethod"
- :common-options="paymentMethodOptions"
- />
+ <el-form-item label="浠樻鏂瑰紡" prop="refundMethod">
+ <div class="common-select">
+ <el-select
+ v-model="editConfig.infomation.refundMethod"
+ placeholder="璇烽�夋嫨"
+ class="common-select-sel"
+ size="mini"
+ >
+ <el-option v-for="item in refundMethodOptions" :key="item.id" :label="item.name" :value="item.id">
+ </el-option>
+ </el-select>
+ <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="璐︽埛" prop="account">
- <CommonSelectView :common-value="editConfig.infomation.account" :common-options="accountOptions" />
+ <el-form-item label="璐︽埛" prop="accountId">
+ <div class="common-select">
+ <el-select
+ v-model="editConfig.infomation.accountId"
+ placeholder="璇烽�夋嫨"
+ class="common-select-sel"
+ size="mini"
+ >
+ <el-option v-for="item in accountOptions" :key="item.id" :label="item.name" :value="item.id">
+ </el-option>
+ </el-select>
+ <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏄惁寮�绁�" prop="whetherInvoicing">
- <CommonSelectView
- :common-value="editConfig.infomation.whetherInvoicing"
- :common-options="whetherInvoicingOptions"
- />
+ <el-form-item label="鏄惁寮�绁�" prop="isInvoice">
+ <div class="common-select">
+ <el-select
+ v-model="editConfig.infomation.isInvoice"
+ placeholder="璇烽�夋嫨"
+ class="common-select-sel"
+ size="mini"
+ >
+ <el-option v-for="item in isInvoiceOptions" :key="item.id" :label="item.name" :value="item.id">
+ </el-option>
+ </el-select>
+ <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ </div>
</el-form-item>
</el-col>
</el-row>
</div>
- <!-- 澶囨敞淇℃伅 -->
- <div class="basic-info-title">澶囨敞淇℃伅</div>
- <div class="address-view">
+ <!-- 閫�娆惧師鍥� -->
+ <div class="basic-info-title">閫�娆惧師鍥�</div>
+ <div class="basic-info-view">
<el-row>
<el-col :span="24">
- <el-form-item label="閫�娆惧師鍥�" prop="refundReason">
+ <el-form-item label="閫�娆惧師鍥�" prop="reason">
<el-input
type="textarea"
:autosize="{ minRows: 2 }"
- v-model="editConfig.infomation.refundReason"
+ v-model="editConfig.infomation.reason"
></el-input>
</el-form-item>
</el-col>
@@ -142,7 +173,13 @@
浜у搧绠$悊
<div style="margin-left: 400px">
甯佺
- <el-select v-model="editConfig.infomation.currency" placeholder="璇烽�夋嫨" size="mini" style="width: 63%">
+ <el-select
+ v-model="editConfig.infomation.currency"
+ placeholder="璇烽�夋嫨"
+ size="mini"
+ style="width: 63%"
+ disabled
+ >
<el-option v-for="item in currencyOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
@@ -152,7 +189,7 @@
<CommonFormTableView :show-summary="showSummary" :product-table-list="productTableList" />
</div>
<!-- 閫夋嫨瀹℃壒娴佺▼ -->
- <div v-if="editConfig.title === '鏂板缓'" class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div>
+ <!-- <div v-if="editConfig.title === '鏂板缓'" class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div>
<div v-if="editConfig.title === '鏂板缓'" class="basic-info-view">
<el-row>
<el-col :span="20">
@@ -189,21 +226,29 @@
</el-form-item>
</el-col>
</el-row>
- </div>
+ </div> -->
</div>
</el-form>
<div slot="footer" class="dialog-footer">
- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button>
- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆瓨</el-button>
+ <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> -->
+ <el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button>
<el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
</div>
+ <!-- 閫夋嫨瀹㈡埛 -->
+ <SelectClientDialog
+ v-if="editSelectClientConfig.editVisible"
+ :edit-common-config="editSelectClientConfig"
+ @selClient="selClient"
+ />
</el-dialog>
</div>
</template>
<script>
-import CommonSelectView from "@/components/makepager/CommonSelectView"
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
+import { getAllData } from "@/api/client/client"
+import { getAddSalesRefund, getUpdateSalesRefund } from "@/api/sales/refundForm"
+import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
export default {
name: "AddRefundFormDialog",
props: {
@@ -213,67 +258,34 @@
return {
visible: false,
title: "鏂板缓",
- infomation: {
- customName: "",
- refundOrderNo: "TKD20230521-12",
- selSourceOrder: "",
- salesHead: "",
- refundDate: "",
- paymentMethod: "",
- account: "",
- whetherInvoicing: "",
- refundReason: "",
- approvalWorkflow: "",
- approvalSteps: "",
- approvalPerson: "",
- approvalOpinion: ""
- }
+ infomation: {}
}
}
}
},
- components: { CommonSelectView, CommonFormTableView },
- computed: {},
+ components: { CommonFormTableView, SelectClientDialog },
+ computed: {
+ clientList() {
+ return this.$store.state.getClientName.clientList
+ }
+ },
data() {
return {
dialogWidth: "80%",
editConfig: this.editCommonConfig,
rules: {
- customName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- refundOrderNo: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ clientId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
refundDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- salesHead: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ memberId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
account: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
},
- salesHeadOptions: [
- // 閿�鍞礋璐d汉
- { value: "1", label: "BOSS" },
- { value: "2", label: "Mia" },
- { value: "3", label: "璐㈠姟" },
- { value: "4", label: "甯傚満" },
- { value: "5", label: "绯荤粺绠$悊鍛�" },
- { value: "6", label: "閿�鍞�" },
- { value: "7", label: "閿�鍞�荤洃" }
- ],
- selSourceOrderOptions: [{ value: "1", label: "閿�鍞��璐у崟" }], // 閫夋嫨婧愬崟
- paymentMethodOptions: [
- { value: "1", label: "鐜伴噾" },
- { value: "2", label: "鏀エ" },
- { value: "3", label: "鐢垫眹" },
- { value: "4", label: "閭斂姹囨" },
- { value: "5", label: "缃戜笂閾惰" },
- { value: "6", label: "鍏朵粬" }
- ], // 浠樻鏂瑰紡
- accountOptions: [{ value: "1", label: "浜烘皯甯佽处鎴�" }], // 璐︽埛
- whetherInvoicingOptions: [
- { value: "1", label: "鏈紑" },
- { value: "2", label: "宸插紑" }
- ], // 鏄惁寮�绁�
- currencyOptions: [
- { value: "1", label: "浜烘皯甯�(楼)" },
- { value: "2", label: "鑻遍晳(拢)" },
- { value: "3", label: "娆у厓(鈧�)" }
- ], // 甯佺
+ memberOptions: [],
+ // selSourceOrderOptions: [{ value: "1", label: "閿�鍞��璐у崟" }], // 閫夋嫨婧愬崟
+ refundMethodOptions: [], // 浠樻鏂瑰紡
+ accountOptions: [], // 璐︽埛
+ isInvoiceOptions: [], // 鏄惁寮�绁�
+ currencyOptions: [], // 甯佺
approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
productTableList: {},
showSummary: {
@@ -281,13 +293,141 @@
total: true,
sumProp: ["other1", "other2", "other3", "other4"],
mergeNumber: 5
+ },
+ editSelectClientConfig: {
+ editVisible: false,
+ title: "",
+ infomation: {}
}
}
},
created() {
+ this.$store.dispatch("geClient")
this.setTableForm()
+ this.getCommonData()
},
methods: {
+ getCommonData() {
+ getAllData()
+ .then((res) => {
+ this.memberOptions = res.data.member
+ this.refundMethodOptions = res.data.refundMethod
+ this.accountOptions = res.data.accountId
+ this.isInvoiceOptions = res.data.isInvoice
+ this.currencyOptions = res.data.currency
+ })
+ .catch((err) => {
+ console.log(err)
+ })
+ },
+ // 淇濆瓨
+ saveClick(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ console.log(this.editConfig.infomation)
+ const params = this.saveParams()
+ console.log(params)
+ if (this.editConfig.title === "鏂板缓") {
+ getAddSalesRefund(params)
+ .then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message({
+ message: "娣诲姞鎴愬姛",
+ type: "success"
+ })
+ this.$parent.getData()
+ }
+ })
+ .catch((err) => {
+ console.log(err)
+ })
+ } else {
+ getUpdateSalesRefund(params)
+ .then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message({
+ message: "缂栬緫鎴愬姛",
+ type: "success"
+ })
+ this.$parent.getData()
+ }
+ })
+ .catch((err) => {
+ console.log(err)
+ })
+ }
+ } else {
+ console.log("error submit")
+ return false
+ }
+ })
+ },
+ saveParams() {
+ let data = this.editConfig.infomation
+ let params = {
+ id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
+ salesRefund: {
+ accountId: data.accountId || 0,
+ clientId: parseInt(data.clientId) || 0,
+ isInvoice: data.isInvoice || 0,
+ memberId: data.memberId || 0,
+ number: data.number || "",
+ products: [
+ {
+ amount: 0,
+ desc: "",
+ id: 0,
+ name: "",
+ number: "",
+ price: 0,
+ total: 0
+ }
+ ],
+ reason: data.reason || "",
+ refundDate: data.refundDate || "",
+ refundMethod: data.refundMethod || ""
+ }
+ }
+ return params
+ },
+ handleClose() {
+ this.editConfig.visible = false
+ },
+ // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
+ querySearchAsync(queryString, cb) {
+ var restaurants = this.clientList
+ var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
+ cb(results)
+ },
+ createStateFilter(queryString) {
+ return (state) => {
+ return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+ }
+ },
+ handleSelectClient(item) {
+ this.editConfig.infomation.client_id = item.id
+ },
+ selClientClick() {
+ this.editSelectClientConfig.editVisible = true
+ },
+ selClient(row) {
+ console.log(row)
+ this.editConfig.infomation.client_name = row.name
+ this.editConfig.infomation.client_id = row.id
+ },
+ // 娓呴櫎宸查�夋嫨鐢ㄦ埛
+ clearupClient() {
+ this.editConfig.infomation.client_name = ""
+ this.editConfig.infomation.client_id = 0
+ },
+ // 娣诲姞闄勪欢
+ addAnnexClick() {},
+ // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
+ setFormatClick() {},
setTableForm() {
this.productTableList = {
tableData: [
@@ -319,14 +459,7 @@
{ label: "鎻忚堪", prop: "other8" }
]
}
- },
- handleClose() {
- this.editConfig.visible = false
- },
- // 娣诲姞闄勪欢
- addAnnexClick() {},
- // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
- setFormatClick() {}
+ }
}
}
</script>
@@ -347,17 +480,18 @@
.basic-info-view {
margin-top: 10px;
padding-right: 40px;
- .custom-name {
+ .custom-name,
+ .common-select {
display: flex;
+ .common-select-sel {
+ width: 270px;
+ }
.common-select-btn {
margin-left: 5px;
- font-size: 18px;
+ font-size: 16px;
+ cursor: pointer;
}
}
- }
- .address-view {
- margin-top: 10px;
- padding-right: 40px;
}
.annex-view {
display: flex;
--
Gitblit v1.8.0