Commit 2e77f41b by chenwq

fix(SignDialog): 添加按钮加载状态防止重复提交

添加btnLoading状态控制防止签名提交按钮被重复点击,优化用户体验并避免重复请求
1 parent 4bc4910f
...@@ -14,36 +14,11 @@ ...@@ -14,36 +14,11 @@
<span>{{ dayjs(detailInfo.deliveryDate).format('YYYY-MM-DD HH:mm:ss') }}</span> <span>{{ dayjs(detailInfo.deliveryDate).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div> </div>
</div> </div>
<!-- <template v-for="(item, index) in detailInfo.deliveryDetailList"> -->
<div class="table-wrap"> <div class="table-wrap">
<!-- <div class="detail-info">
<div>
商品名称:
<span>{{ detailInfo.upgradeGoodsName }}&nbsp;&nbsp; {{ detailInfo.specificationData }}</span>
</div>
<div>
发货数量:
<span>{{ membraneTypeList.includes(detailInfo.goodsType) ? `${detailInfo.purchaseNumber}卷` : `${detailInfo.purchaseNumber}件` }}</span>
</div>
<div>
可用库存数量:
<span>{{ detailInfo.stockNum }}{{ membraneTypeList.includes(detailInfo.goodsType) ? `米` : `件` }}</span>
</div>
</div> -->
<!-- <el-form ref="addForm" :model="detailInfo" size="small" v-if="detailInfo.deliveryCardList === null || detailInfo.deliveryCardList.length == 0"> -->
<el-form ref="addForm" :model="detailInfo" size="small"> <el-form ref="addForm" :model="detailInfo" size="small">
<GLTable :tableData="detailInfo.deliveryDetailList" :noDataImg="url" :tableParams="tableParams" :hasPage="false"> <GLTable :tableData="detailInfo.deliveryDetailList" :noDataImg="url" :tableParams="tableParams" :hasPage="false">
<!-- <template slot="increaseStockNum" slot-scope="scope">
<span>{{ scope.scope.increaseStockNum || scope.scope.increaseStockNum == 0 ?
(membraneTypeList.includes(scope.scope.goodsType) ? parseFloat(scope.scope.increaseStockNum /
scope.scope.alternateUnits).toFixed(2) : parseFloat(scope.scope.increaseStockNum).toFixed(2)) +
(membraneTypeList.includes(scope.scope.goodsType) ? '卷' : '件') : '-' }}</span>
</template> -->
</GLTable> </GLTable>
</el-form> </el-form>
<!-- <div v-else class="message">
已自动入库至商户的权益卡管理中,可前往“库存管理-权益卡管理”中查询
</div> -->
<div class="sign-box"> <div class="sign-box">
<div class="red-txt">*请在区域内签字完成</div> <div class="red-txt">*请在区域内签字完成</div>
<div class="background-text">签字区</div> <div class="background-text">签字区</div>
...@@ -51,7 +26,6 @@ ...@@ -51,7 +26,6 @@
<VueSignaturePad width="100%" height="100%" ref="signaturePad" :options="options" /> <VueSignaturePad width="100%" height="100%" ref="signaturePad" :options="options" />
</div> </div>
<div class="btns"> <div class="btns">
<!-- <el-button type="text" size="mini" @click="save">保存</el-button> -->
<el-button type="text" size="mini" @click="clear">清除</el-button> <el-button type="text" size="mini" @click="clear">清除</el-button>
<el-button type="text" size="mini" @click="undo">撤销</el-button> <el-button type="text" size="mini" @click="undo">撤销</el-button>
</div> </div>
...@@ -98,6 +72,7 @@ export default { ...@@ -98,6 +72,7 @@ export default {
velocityFilterWeight: 0.7, velocityFilterWeight: 0.7,
backgroundColor: 'rgba(255, 255, 255, 0.0)' backgroundColor: 'rgba(255, 255, 255, 0.0)'
}, },
btnLoading: false,
membraneTypeList: membraneTypeList, membraneTypeList: membraneTypeList,
dayjs: dayjs, dayjs: dayjs,
goodsList: [], goodsList: [],
...@@ -128,19 +103,6 @@ export default { ...@@ -128,19 +103,6 @@ export default {
return cellValue.stockNum + (membraneTypeList.includes(cellValue.goodsType) ? '米' : '件') return cellValue.stockNum + (membraneTypeList.includes(cellValue.goodsType) ? '米' : '件')
} }
} }
// {
// label: '入库数量',
// prop: 'increaseStockNum',
// addHtml: 'increaseStockNum'
// },
// {
// label: '入库仓库',
// prop: 'yqMerchantName'
// },
// {
// label: '入库门店',
// prop: 'merchantName'
// }
] ]
}, },
tableData: [], tableData: [],
...@@ -161,6 +123,9 @@ export default { ...@@ -161,6 +123,9 @@ export default {
// return // return
// } // }
const { isEmpty, data } = this.$refs.signaturePad.saveSignature() const { isEmpty, data } = this.$refs.signaturePad.saveSignature()
if (this.btnLoading) {
return
}
if (isEmpty) { if (isEmpty) {
this.$message({ this.$message({
message: '请先完成签名', message: '请先完成签名',
...@@ -184,6 +149,7 @@ export default { ...@@ -184,6 +149,7 @@ export default {
id: this.info.orderDeliveryId, id: this.info.orderDeliveryId,
signFileUrl: url signFileUrl: url
} }
this.btnLoading = true
console.log(params, 'params----') console.log(params, 'params----')
this.$apis.delivery.deliverySign(params) this.$apis.delivery.deliverySign(params)
.then(res => { .then(res => {
...@@ -203,7 +169,7 @@ export default { ...@@ -203,7 +169,7 @@ export default {
} }
}) })
.finally(() => { .finally(() => {
this.loading = false this.btnLoading = false
}) })
}, },
handleDetailClose() { handleDetailClose() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!