sendAmountModal.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <a-modal
  3. centered
  4. class="promotionList-basicInfo-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="规则设置"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="70%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-form-model
  13. id="promotionList-basicInfo-form"
  14. ref="ruleForm"
  15. :model="form"
  16. :rules="rules"
  17. :label-col="formItemLayout.labelCol"
  18. :wrapper-col="formItemLayout.wrapperCol" >
  19. <a-form-model-item label="规则门槛" prop="gateFlag">
  20. <div class="fixWidthBox">
  21. <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
  22. <a-radio-button value="1">
  23. </a-radio-button>
  24. <a-radio-button value="0">
  25. </a-radio-button>
  26. </a-radio-group>
  27. </div>
  28. <div v-if="form.gateFlag && form.gateFlag === '1'">
  29. <v-select
  30. size="small"
  31. style="width:60%;"
  32. v-model="form.gateType"
  33. id="promotionList-gateType"
  34. code="PROMOTION_GATE_TYPE"
  35. placeholder="请选择门槛与配额设置要求"
  36. @change="changeGateTypeFlag"
  37. allowClear></v-select>
  38. <div v-if="form.gateType==='RATIO_AMOUNT'">
  39. 购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
  40. <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
  41. <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
  42. </a-tooltip>
  43. </div>
  44. <div v-if="form.gateType==='MIN_AMOUNT'">
  45. 购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="2" size="small"/>元,不限制配额。
  46. </div>
  47. <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
  48. 购买满
  49. <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>
  50. 元门槛产品,可使用
  51. <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
  52. 元配额,采购规则中的正价商品(配额算销售额)
  53. </div>
  54. </div>
  55. </a-form-model-item>
  56. <a-form-model-item label="规则简称" prop="description">
  57. <a-input
  58. size="small"
  59. id="promotionList-description"
  60. v-model.trim="form.description"
  61. allowClear
  62. placeholder="请输入规则简称(最多20个字符)"
  63. :maxLength="20"></a-input>
  64. </a-form-model-item>
  65. <a-form-model-item label="满赠规则" prop="giveRuleType">
  66. <a-select default-value="SUM_MONEY" v-model="form.giveRuleType" style="width: 160px" size="small" allowClear>
  67. <a-select-option value="SUM_MONEY">
  68. 金额叠加
  69. </a-select-option>
  70. <a-select-option value="RATIO">
  71. 按比例
  72. </a-select-option>
  73. </a-select>
  74. <a-tooltip title="数量叠加:(如:满1000送200,金额叠加则:满2000送400,以此类推)" v-if="form.giveRuleType=='SUM_MONEY'">
  75. <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' ,'margin-left':'5px'}"/>
  76. </a-tooltip>
  77. <a-tooltip title="按比例:(如满100元送2%,按比例则:满120送2.4元)" v-else>
  78. <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' ,'margin-left':'5px'}"/>
  79. </a-tooltip>
  80. <div class="ruleDescList" v-if="form.giveRuleType==='SUM_MONEY'">
  81. 购买满
  82. <a-input-number
  83. v-model="fullGiftRuleList[0].regularValue"
  84. @blur="calculatePrice"
  85. :max="999999"
  86. :step="1"
  87. :precision="form.regularUnit==='YUAN'?2:0"
  88. :min="0"
  89. size="small"/>
  90. <a-select
  91. default-value="YUAN"
  92. v-model="form.regularUnit"
  93. style="width: 50px;margin-left:5px;"
  94. size="small"
  95. @change="handleUnit">
  96. <a-select-option value="YUAN">
  97. </a-select-option>
  98. <a-select-option value="GE">
  99. </a-select-option>
  100. </a-select>
  101. 正价产品,送
  102. <a-input-number
  103. v-model="fullGiftRuleList[0].promotionValue"
  104. @blur="calculatePrice"
  105. :min="0"
  106. :step="1"
  107. :max="999999"
  108. :precision="2"
  109. size="small"/>
  110. 元<span>({{ form.regularUnit==='YUAN'? scaleNum+'%':'' }}促销品采购额)</span>
  111. </div>
  112. <div class="fullGiftRuleBox" v-else>
  113. <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
  114. <span>{{ i*1+1 }}、</span>
  115. 购买满
  116. <a-input-number
  117. v-model="con.regularValue"
  118. :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
  119. :step="1"
  120. :max="999999"
  121. :precision="form.regularUnit==='YUAN'?2:0"
  122. size="small"/>
  123. <a-select
  124. default-value="YUAN"
  125. v-model="form.regularUnit"
  126. @change="handleChangeUnit"
  127. style="width: 50px;margin-left:5px;"
  128. size="small"
  129. :disabled="i!=0">
  130. <a-select-option value="YUAN">
  131. </a-select-option>
  132. <a-select-option value="GE">
  133. </a-select-option>
  134. </a-select>
  135. 正价产品,送正价产品总金额的
  136. <a-input-number
  137. v-model="con.promotionValue"
  138. :min="0"
  139. :step="1"
  140. :precision="0"
  141. :max="999999"
  142. size="small"/>
  143. %为促销品采购额
  144. <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
  145. <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(i)">删除</a-button>
  146. </div>
  147. </div>
  148. </a-form-model-item>
  149. <a-form-model-item label="采购额适用范围" prop="scopeFlag">
  150. <div class="fixWidthBox">
  151. <a-radio-group v-model="form.scopeFlag" button-style="solid" size="small">
  152. <a-radio-button value="0">
  153. 部分产品
  154. </a-radio-button>
  155. <a-radio-button value="1">
  156. 全部产品
  157. </a-radio-button>
  158. </a-radio-group>
  159. </div>
  160. </a-form-model-item>
  161. </a-form-model>
  162. <a-card size="small" :bordered="false" class="pages-wrap">
  163. <div class="flex">
  164. <a-radio-group v-model="chooseVal" button-style="solid">
  165. <a-radio-button value="a" v-show="form.gateFlag==='1'">
  166. 门槛产品
  167. </a-radio-button>
  168. <a-radio-button value="b">
  169. 正价产品
  170. </a-radio-button>
  171. <a-radio-button value="c" v-show="form.scopeFlag==='0'">
  172. 促销产品
  173. </a-radio-button>
  174. </a-radio-group>
  175. <a-button
  176. size="small"
  177. type="link"
  178. class="button-info"
  179. @click="openGuideModal=true"
  180. id="promotionList-edit-btn">+导入产品</a-button>
  181. </div>
  182. <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
  183. <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
  184. <div v-show="chooseVal=='c'"><tableType1 ref="offerProduct"></tableType1></div>
  185. </a-card>
  186. <div class="btn-cont">
  187. <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
  188. <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
  189. </div>
  190. </a-spin>
  191. <!-- 导入产品 -->
  192. <importGuideModal goodFlag="1" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
  193. </a-modal>
  194. </template>
  195. <script>
  196. import { commonMixin } from '@/utils/mixin'
  197. import { VSelect } from '@/components'
  198. import tableType1 from './tableType1.vue'
  199. import { promotionSave, getRuleDetail } from '@/api/promotion'
  200. import ImportGuideModal from './importGuideModal.vue'
  201. export default {
  202. name: 'PromotionListBasicInfoModal',
  203. mixins: [commonMixin],
  204. components: { VSelect, tableType1, ImportGuideModal },
  205. props: {
  206. openModal: { // 弹框显示状态
  207. type: Boolean,
  208. default: false
  209. },
  210. promotionSn: {
  211. type: [Number, String],
  212. default: ''
  213. },
  214. itemSn: {
  215. type: [Number, String],
  216. default: ''
  217. }
  218. },
  219. data () {
  220. return {
  221. isShow: this.openModal, // 是否打开弹框
  222. spinning: false,
  223. formItemLayout: {
  224. labelCol: { span: 4 },
  225. wrapperCol: { span: 17 }
  226. },
  227. form: {
  228. promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
  229. description: '',
  230. gateFlag: '0', // 门槛
  231. gateType: undefined,
  232. gateValue: undefined,
  233. quotaAmount: undefined,
  234. giveRuleType: 'SUM_MONEY',
  235. regularUnit: 'YUAN',
  236. scopeFlag: '1',
  237. gateInfo: undefined,
  238. ruleInfo: undefined
  239. },
  240. rules: {
  241. description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
  242. gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
  243. giveRuleType: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
  244. scopeFlag: [{ required: true, message: '请选择采购额适用范围', trigger: 'change' }]
  245. },
  246. chooseVal: 'a',
  247. scaleNum: 0,
  248. openGuideModal: false,
  249. fullGiftRuleList: [{
  250. regularValue: undefined,
  251. promotionValue: undefined
  252. }]
  253. }
  254. },
  255. methods: {
  256. // 单位切换时,满赠规则数据清空
  257. handleUnit (val) {
  258. this.form.regularUnit = val
  259. this.fullGiftRuleList[0].regularValue = undefined
  260. },
  261. handleChangeUnit (e) {
  262. this.form.regularUnit = e
  263. this.fullGiftRuleList.forEach(item => {
  264. item.regularValue = undefined
  265. })
  266. },
  267. // 新增 满减规则 最多能添加五个
  268. addFullGiftRule () {
  269. const obj = {
  270. regularSameFlag: '1',
  271. regularQty: undefined,
  272. promotionQty: undefined
  273. }
  274. this.fullGiftRuleList.push(obj)
  275. },
  276. // 删除满减规则
  277. delFullGiftRule (pos) {
  278. this.fullGiftRuleList.splice(pos, 1)
  279. },
  280. // 导入
  281. closeGuideModel () {
  282. this.openGuideModal = false
  283. },
  284. hanldeOk (arr) {
  285. const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
  286. this.$refs[name + 'Product'].importRow(arr)
  287. },
  288. // 计算百分比
  289. calculatePrice () {
  290. const _this = this
  291. if (_this.form.giveRuleType === 'SUM_MONEY' && _this.form.regularUnit === 'YUAN' && _this.fullGiftRuleList[0].promotionValue && _this.fullGiftRuleList[0].regularValue) {
  292. _this.scaleNum = ((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)
  293. } else {
  294. _this.scaleNum = 0
  295. }
  296. },
  297. // 门槛切换 tab 按钮默认显示问题
  298. changeGateFlag (e) {
  299. if (e.target.value == '0') {
  300. this.chooseVal = 'b'
  301. this.form.gateType = undefined
  302. this.form.gateValue = undefined
  303. this.form.quotaAmount = undefined
  304. } else {
  305. this.chooseVal = 'a'
  306. }
  307. },
  308. changeGateTypeFlag (val) {
  309. this.form.gateType = val
  310. this.form.gateValue = undefined
  311. this.form.quotaAmount = undefined
  312. },
  313. // 保存
  314. handleSave () {
  315. const _this = this
  316. this.$refs.ruleForm.validate(valid => {
  317. if (valid) {
  318. // 验证必填
  319. if (_this.form.gateFlag == '1') {
  320. if (!_this.form.gateType) {
  321. _this.$message.warning('请选择规则门槛设置类型!')
  322. return
  323. }
  324. if (!_this.form.gateValue) {
  325. _this.$message.warning('规则门槛条件不能为空!')
  326. return
  327. }
  328. if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
  329. _this.$message.warning('规则门槛条件不能为空!')
  330. return
  331. }
  332. }
  333. const form = JSON.parse(JSON.stringify(_this.form))
  334. let rowFlag1, rowFlag2, rowFlag3
  335. if (form.gateFlag == '1') {
  336. form.gateProductList = this.$refs.cillProduct.getResultVal() // 规则门槛
  337. form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
  338. if (form.gateProductList.length == 0) {
  339. _this.$message.warning('请添加门槛产品!')
  340. return
  341. } else {
  342. const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
  343. if (qtyFlag) {
  344. _this.$message.warning('订单起订量设置不能为空!')
  345. return
  346. }
  347. rowFlag1 = _this.isJudge(form.gateProductList)
  348. }
  349. } else {
  350. form.gateProductList = []
  351. form.gateValue = ''
  352. form.quotaAmount = ''
  353. form.gateType = undefined
  354. }
  355. // 正价产品判断表格必填
  356. form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
  357. if (form.regularProductList.length == 0) {
  358. _this.$message.warning('请添加正价产品!')
  359. return
  360. } else {
  361. const qtyFlag = form.regularProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
  362. if (qtyFlag) {
  363. _this.$message.warning('订单起订量设置不能为空!')
  364. return
  365. }
  366. rowFlag2 = _this.isJudge(form.regularProductList)
  367. }
  368. // 促销产品
  369. if (form.scopeFlag == '0') {
  370. form.giftProductList = this.$refs.offerProduct.getResultVal()
  371. if (form.giftProductList.length == 0) {
  372. _this.$message.warning('请添加促销产品!')
  373. return
  374. }
  375. rowFlag3 = _this.isJudge(form.giftProductList)
  376. } else {
  377. form.giftProductList = []
  378. }
  379. if (rowFlag1 || rowFlag2 || rowFlag3) {
  380. _this.$message.warning('请选择产品分类、品牌或产品!')
  381. return
  382. }
  383. // 组传给后台所需数据
  384. _this.fullGiftRuleList.map((val, i) => {
  385. val.scopeLevel = i * 1 + 1
  386. val.regularUnit = form.regularUnit
  387. })
  388. form.promotionSn = _this.promotionSn
  389. form.giveRuleList = _this.fullGiftRuleList
  390. if (form.gateFlag == '1') {
  391. if (form.gateType === 'RATIO_AMOUNT') {
  392. form.gateInfo = '购买门槛产品金额' + form.gateValue + '作为配额'
  393. } else if (form.gateType === 'MIN_AMOUNT') {
  394. form.gateInfo = '购买门槛产品满最低金额' + form.gateValue + '不限制配额'
  395. } else {
  396. form.gateInfo = '购买满' + form.gateValue + '元门槛产品,可使用' + form.quotaAmount + '元配额,采购规则中的正价商品(配额算销售额)'
  397. }
  398. }
  399. var newInfo = ''
  400. if (form.giveRuleType == 'SUM_MONEY') {
  401. newInfo = `<span>金额叠加;购买满${_this.fullGiftRuleList[0].regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${_this.fullGiftRuleList[0].promotionValue}元</span>`
  402. if (form.regularUnit == 'YUAN') {
  403. newInfo += `<span>(${((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)} %促销品采购额)</span>`
  404. }
  405. } else {
  406. newInfo = '按比例;'
  407. _this.fullGiftRuleList.forEach(item => {
  408. newInfo += `<div>购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue}%为促销品采购额</div>`
  409. })
  410. }
  411. form.ruleInfo = newInfo
  412. _this.spinning = true
  413. promotionSave(form).then(res => {
  414. if (res.status == 200) {
  415. _this.$message.success(res.message)
  416. setTimeout(() => {
  417. _this.isShow = false
  418. _this.$emit('ok')
  419. _this.spinning = false
  420. }, 1000)
  421. } else {
  422. _this.spinning = false
  423. }
  424. })
  425. } else {
  426. return false
  427. }
  428. })
  429. },
  430. // 判断品牌,分类,产品其中一个必填
  431. isJudge (list) {
  432. let flag = null
  433. list.forEach(con => {
  434. if (con.productThisList) {
  435. if (con.productThisList.length > 0) {
  436. flag = false
  437. } else {
  438. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  439. flag = false
  440. } else {
  441. flag = true
  442. }
  443. }
  444. } else {
  445. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  446. flag = false
  447. } else {
  448. flag = true
  449. }
  450. }
  451. })
  452. return flag
  453. },
  454. // 重置表格
  455. resetSearchForm () {
  456. this.form = {
  457. promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
  458. description: '',
  459. gateFlag: '0', // 门槛
  460. gateType: undefined,
  461. gateValue: undefined,
  462. quotaAmount: undefined,
  463. giveRuleType: 'SUM_MONEY',
  464. regularUnit: 'YUAN',
  465. scopeFlag: '1',
  466. gateProductList: undefined,
  467. giftProductList: undefined,
  468. regularProductList: undefined,
  469. gateInfo: undefined,
  470. ruleInfo: undefined
  471. }
  472. this.$nextTick(() => {
  473. this.$refs.ruleForm.resetFields()
  474. this.$refs.cillProduct.reSetTableData()
  475. this.$refs.normalPriceProduct.reSetTableData()
  476. this.scaleNum = 0
  477. })
  478. if (this.form.giveRuleType === 'SUM_MONEY') {
  479. this.$refs.offerProduct.reSetTableData()
  480. } else {
  481. this.fullGiftRuleList.forEach((val, i) => {
  482. this.$refs['offerProduct' + i][0].reSetTableData()
  483. })
  484. }
  485. this.fullGiftRuleList = [{
  486. regularValue: undefined,
  487. promotionValue: undefined
  488. }]
  489. },
  490. // 获取编辑详情
  491. getDetail () {
  492. const _this = this
  493. getRuleDetail({ sn: this.itemSn }).then(res => {
  494. if (res.status == 200) {
  495. this.chooseVal = res.data.gateFlag == '0' ? 'b' : 'a'
  496. const resultObj = res.data
  497. if (resultObj.gateFlag === '1') {
  498. resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
  499. }
  500. if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
  501. _this.fullGiftRuleList = resultObj.giveRuleList
  502. }
  503. // 重新组成保存数据
  504. if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
  505. resultObj.gateProductList = _this.newData(resultObj.gateProductList)
  506. this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
  507. }
  508. if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
  509. resultObj.regularProductList = _this.newData(resultObj.regularProductList)
  510. this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
  511. }
  512. if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
  513. resultObj.giftProductList = _this.newData(resultObj.giftProductList)
  514. this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
  515. }
  516. this.form = { ...this.form, ...resultObj }
  517. }
  518. })
  519. },
  520. newData (list) {
  521. list.forEach(con => {
  522. // 品牌
  523. if (con.productBrandList) {
  524. const brandList = []
  525. con.productBrandList.forEach(item => {
  526. item.brandName = item.productBrandName
  527. const brandObj = {
  528. productBrandSn: item.productBrandSn
  529. }
  530. brandList.push(brandObj)
  531. })
  532. con.productBrandArr = con.productBrandList
  533. con.productBrandList = brandList
  534. }
  535. // 分类
  536. if (con.productTypeList) {
  537. const typeList = []
  538. con.productTypeList.forEach(item => {
  539. const typeObj = {}
  540. item.title = ''
  541. const num = 3
  542. for (var i = 0; i < num; i++) {
  543. if (item['productTypeName' + (i + 1)]) {
  544. // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
  545. typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
  546. }
  547. }
  548. // item.title = item.title.slice(0, item.title.length - 1)
  549. if (item.productTypeName3) {
  550. item.title = item.productTypeName2 + '/' + item.productTypeName3
  551. } else if (!item.productTypeName3 && item.productTypeName2) {
  552. item.title = item.productTypeName2
  553. } else {
  554. item.title = item.productTypeName1
  555. }
  556. item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
  557. typeList.push(typeObj)
  558. })
  559. con.productTypeArr = con.productTypeList
  560. con.productTypeList = typeList
  561. }
  562. // 产品
  563. if (con.productThisList) {
  564. const productList = []
  565. con.productThisList.forEach(item => {
  566. const productObj = {
  567. productCode: item.productCode,
  568. productSn: item.productSn
  569. }
  570. productList.push(productObj)
  571. })
  572. con.productThisList = productList
  573. }
  574. })
  575. return list
  576. }
  577. },
  578. watch: {
  579. // 父页面传过来的弹框状态
  580. openModal (newValue, oldValue) {
  581. this.isShow = newValue
  582. },
  583. // 重定义的弹框状态
  584. isShow (newValue, oldValue) {
  585. if (!newValue) {
  586. this.$emit('close')
  587. this.resetSearchForm()
  588. } else {
  589. if (this.itemSn) {
  590. this.getDetail()
  591. } else {
  592. this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
  593. }
  594. }
  595. }
  596. }
  597. }
  598. </script>
  599. <style lang="less" scoped>
  600. .promotionList-basicInfo-modal{
  601. /deep/.ant-modal-body {
  602. padding: 20px 30px;
  603. max-height: 745px !important;
  604. overflow-y: scroll !important;
  605. }
  606. .fixWidthBox .ant-radio-button-wrapper{
  607. width:80px;
  608. text-align: center;
  609. }
  610. .ant-form-item{
  611. margin-bottom:5px;
  612. }
  613. .buyerBox{
  614. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  615. }
  616. .btn-cont {
  617. text-align: center;
  618. margin: 35px 0 10px;
  619. }
  620. .flex{
  621. display:flex;
  622. align-items:center;
  623. justify-content:space-between;
  624. }
  625. }
  626. </style>