|
|
@@ -236,12 +236,15 @@
|
|
|
|
|
|
<script>
|
|
|
import { createOrder } from '@/api/order/index'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
|
|
|
const CALC_HISTORY_STORAGE_KEY = 'ghsApp_calculator_calcHistory'
|
|
|
const DISCOUNT_CUSTOM_STORAGE_KEY = 'ghsApp_calculator_customDiscountZhe'
|
|
|
const DISCOUNT_SELECTED_STORAGE_KEY = 'ghsApp_calculator_discountZhe'
|
|
|
/** 计算器选客回填:对应 selectCustom style=3 */
|
|
|
const CALCULATOR_PICK_CUSTOMER_KEY = 'ghsApp_calculator_pick_customer'
|
|
|
+/** 与首页「快捷开单」一致:取自 loginInfo.skCustomId,界面展示名固定 */
|
|
|
+const SHORTCUT_CUSTOM_DISPLAY_NAME = '快捷开单'
|
|
|
|
|
|
const SETTLE_FORM_DEFAULTS = {
|
|
|
sendType: 1,
|
|
|
@@ -303,9 +306,21 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapGetters({ loginInfo: 'getLoginInfo' }),
|
|
|
+ /** 工作台「快捷开单」客户 id,与 workbench skKd 使用的 loginInfo.skCustomId 一致 */
|
|
|
+ shortcutCustomerId() {
|
|
|
+ const login = this.loginInfo || {}
|
|
|
+ const sid = login.skCustomId
|
|
|
+ if (this.$util.isEmpty(sid) || Number(sid) <= 0) return 0
|
|
|
+ return Number(sid)
|
|
|
+ },
|
|
|
customerDisplayName() {
|
|
|
const n = (this.customName || '').trim()
|
|
|
if (n) return n
|
|
|
+ const skid = this.shortcutCustomerId
|
|
|
+ if (Number(this.customId) > 0 && skid > 0 && Number(this.customId) === skid) {
|
|
|
+ return SHORTCUT_CUSTOM_DISPLAY_NAME
|
|
|
+ }
|
|
|
if (Number(this.customId) > 0) return '—'
|
|
|
return '未选择'
|
|
|
},
|
|
|
@@ -345,6 +360,9 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
+ shortcutCustomerId(n) {
|
|
|
+ if (n > 0 && Number(this.customId) <= 0) this.applyDefaultShortcutCustomer()
|
|
|
+ },
|
|
|
stackDiscountedAmount: {
|
|
|
handler(v) {
|
|
|
if (this.keyboardTarget === 'calc') {
|
|
|
@@ -363,9 +381,11 @@ export default {
|
|
|
if (options && options.customName) {
|
|
|
this.customName = decodeURIComponent(String(options.customName))
|
|
|
}
|
|
|
+ this.applyDefaultShortcutCustomer()
|
|
|
},
|
|
|
onShow() {
|
|
|
this.applyPickCustomerFromStorage()
|
|
|
+ this.applyDefaultShortcutCustomer()
|
|
|
},
|
|
|
mounted() {
|
|
|
this.loadCalcHistoryFromStorage()
|
|
|
@@ -391,6 +411,14 @@ export default {
|
|
|
uni.removeStorageSync(CALCULATOR_PICK_CUSTOMER_KEY)
|
|
|
} catch (e) {}
|
|
|
},
|
|
|
+ /** 未选客且无路由参数带入时,默认工作台设置的快捷客户 */
|
|
|
+ applyDefaultShortcutCustomer() {
|
|
|
+ if (Number(this.customId) > 0) return
|
|
|
+ const skid = this.shortcutCustomerId
|
|
|
+ if (!skid || skid <= 0) return
|
|
|
+ this.customId = skid
|
|
|
+ this.customName = SHORTCUT_CUSTOM_DISPLAY_NAME
|
|
|
+ },
|
|
|
loadCalcHistoryFromStorage() {
|
|
|
try {
|
|
|
const raw = uni.getStorageSync(CALC_HISTORY_STORAGE_KEY)
|
|
|
@@ -1117,7 +1145,7 @@ export default {
|
|
|
zjGathering: 1,
|
|
|
dealPrice: 1,
|
|
|
getGoods: 1,
|
|
|
- product: JSON.stringify([]),
|
|
|
+ product: '',
|
|
|
payWay: Number(formPayload.hasPay) === 1 ? (formPayload.payWay != null ? formPayload.payWay : 0) : 0,
|
|
|
}
|
|
|
uni.showLoading({ mask: true })
|