sendAmountModal.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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="description">
  20. <a-input
  21. size="small"
  22. id="promotionList-description"
  23. v-model.trim="form.description"
  24. allowClear
  25. placeholder="请输入规则简称(最多20个字符)"
  26. :maxLength="20"></a-input>
  27. </a-form-model-item>
  28. <a-form-model-item label="规则门槛" prop="gateFlag">
  29. <div class="fixWidthBox">
  30. <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
  31. <a-radio-button value="1">
  32. </a-radio-button>
  33. <a-radio-button value="0">
  34. </a-radio-button>
  35. </a-radio-group>
  36. </div>
  37. <div v-if="form.gateFlag && form.gateFlag === '1'">
  38. <v-select
  39. size="small"
  40. style="width:60%;"
  41. v-model="form.gateType"
  42. id="promotionList-gateType"
  43. code="PROMOTION_GATE_TYPE"
  44. placeholder="请选择门槛与配额设置要求"
  45. @change="changeGateTypeFlag"
  46. allowClear></v-select>
  47. <div v-if="form.gateType==='RATIO_AMOUNT'">
  48. 购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
  49. <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
  50. <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
  51. </a-tooltip>
  52. </div>
  53. <div v-if="form.gateType==='MIN_AMOUNT'">
  54. 购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="2" size="small"/>元,不限制配额。
  55. </div>
  56. <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
  57. 购买满
  58. <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>
  59. 元门槛产品,可使用
  60. <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
  61. 元配额,采购规则中的正价商品(配额算销售额)
  62. </div>
  63. </div>
  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" @change="handleRuleType">
  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="2"
  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. handleRuleType (val) {
  258. this.form.giveRuleType = val
  259. this.fullGiftRuleList = [{
  260. regularValue: undefined,
  261. promotionValue: undefined
  262. }]
  263. },
  264. // 单位切换时,满赠规则数据清空
  265. handleUnit (val) {
  266. this.form.regularUnit = val
  267. this.fullGiftRuleList[0].regularValue = undefined
  268. },
  269. handleChangeUnit (e) {
  270. this.form.regularUnit = e
  271. this.fullGiftRuleList.forEach(item => {
  272. item.regularValue = undefined
  273. })
  274. },
  275. // 新增 满减规则 最多能添加五个
  276. addFullGiftRule () {
  277. const obj = {
  278. regularSameFlag: '1',
  279. regularQty: undefined,
  280. promotionQty: undefined
  281. }
  282. this.fullGiftRuleList.push(obj)
  283. },
  284. // 删除满减规则
  285. delFullGiftRule (pos) {
  286. this.fullGiftRuleList.splice(pos, 1)
  287. },
  288. // 导入
  289. closeGuideModel () {
  290. this.openGuideModal = false
  291. },
  292. hanldeOk (arr) {
  293. const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
  294. this.$refs[name + 'Product'].importRow(arr)
  295. },
  296. // 计算百分比
  297. calculatePrice () {
  298. const _this = this
  299. if (_this.form.giveRuleType === 'SUM_MONEY' && _this.form.regularUnit === 'YUAN' && _this.fullGiftRuleList[0].promotionValue && _this.fullGiftRuleList[0].regularValue) {
  300. _this.scaleNum = ((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)
  301. } else {
  302. _this.scaleNum = 0
  303. }
  304. },
  305. // 门槛切换 tab 按钮默认显示问题
  306. changeGateFlag (e) {
  307. if (e.target.value == '0') {
  308. this.chooseVal = 'b'
  309. this.form.gateType = undefined
  310. this.form.gateValue = undefined
  311. this.form.quotaAmount = undefined
  312. } else {
  313. this.chooseVal = 'a'
  314. }
  315. },
  316. changeGateTypeFlag (val) {
  317. this.form.gateType = val
  318. this.form.gateValue = undefined
  319. this.form.quotaAmount = undefined
  320. },
  321. // 保存
  322. handleSave () {
  323. const _this = this
  324. this.$refs.ruleForm.validate(valid => {
  325. if (valid) {
  326. // 验证必填
  327. if (_this.form.gateFlag == '1') {
  328. if (!_this.form.gateType) {
  329. _this.$message.warning('请选择规则门槛设置类型!')
  330. return
  331. }
  332. if (!_this.form.gateValue) {
  333. _this.$message.warning('规则门槛条件不能为空!')
  334. return
  335. }
  336. if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
  337. _this.$message.warning('规则门槛条件不能为空!')
  338. return
  339. }
  340. }
  341. if (_this.form.giveRuleType == 'SUM_MONEY') {
  342. if (_this.fullGiftRuleList[0].regularValue <= 0 || _this.fullGiftRuleList[0].promotionValue <= 0) {
  343. _this.$message.warning('满赠规则条件不能为空!')
  344. return
  345. }
  346. } else {
  347. const hasNullVal = _this.fullGiftRuleList.some(itemVal => (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0))
  348. if (hasNullVal) {
  349. _this.$message.warning('满赠规则条件不能为空!')
  350. return
  351. }
  352. }
  353. const form = JSON.parse(JSON.stringify(_this.form))
  354. let rowFlag1, rowFlag2, rowFlag3
  355. if (form.gateFlag == '1') {
  356. form.gateProductList = this.$refs.cillProduct.getResultVal() // 规则门槛
  357. form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
  358. if (form.gateProductList.length == 0) {
  359. _this.$message.warning('请添加门槛产品!')
  360. return
  361. } else {
  362. const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
  363. if (qtyFlag) {
  364. _this.$message.warning('订单起订量设置不能为空!')
  365. return
  366. }
  367. rowFlag1 = _this.isJudge(form.gateProductList)
  368. }
  369. } else {
  370. form.gateProductList = []
  371. form.gateValue = ''
  372. form.quotaAmount = ''
  373. form.gateType = undefined
  374. }
  375. // 正价产品判断表格必填
  376. form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
  377. if (form.regularProductList.length == 0) {
  378. _this.$message.warning('请添加正价产品!')
  379. return
  380. } else {
  381. const qtyFlag = form.regularProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
  382. if (qtyFlag) {
  383. _this.$message.warning('订单起订量设置不能为空!')
  384. return
  385. }
  386. rowFlag2 = _this.isJudge(form.regularProductList)
  387. }
  388. // 促销产品
  389. if (form.scopeFlag == '0') {
  390. form.giftProductList = this.$refs.offerProduct.getResultVal()
  391. if (form.giftProductList.length == 0) {
  392. _this.$message.warning('请添加促销产品!')
  393. return
  394. }
  395. rowFlag3 = _this.isJudge(form.giftProductList)
  396. } else {
  397. form.giftProductList = []
  398. }
  399. if (rowFlag1 || rowFlag2 || rowFlag3) {
  400. _this.$message.warning('请选择产品分类、品牌或产品!')
  401. return
  402. }
  403. // 组传给后台所需数据
  404. _this.fullGiftRuleList.map((val, i) => {
  405. val.scopeLevel = i * 1 + 1
  406. val.regularUnit = form.regularUnit
  407. })
  408. form.promotionSn = _this.promotionSn
  409. form.giveRuleList = _this.fullGiftRuleList
  410. if (form.gateFlag == '1') {
  411. if (form.gateType === 'RATIO_AMOUNT') {
  412. form.gateInfo = '购买门槛产品金额' + form.gateValue + '作为配额'
  413. } else if (form.gateType === 'MIN_AMOUNT') {
  414. form.gateInfo = '购买门槛产品满最低金额' + form.gateValue + '不限制配额'
  415. } else {
  416. form.gateInfo = '购买满' + form.gateValue + '元门槛产品,可使用' + form.quotaAmount + '元配额,采购规则中的正价商品(配额算销售额)'
  417. }
  418. }
  419. var newInfo = ''
  420. if (form.giveRuleType == 'SUM_MONEY') {
  421. newInfo = `<span>金额叠加;购买满${_this.fullGiftRuleList[0].regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${_this.fullGiftRuleList[0].promotionValue}元</span>`
  422. if (form.regularUnit == 'YUAN') {
  423. newInfo += `<span>(${((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)} %促销品采购额)</span>`
  424. }
  425. } else {
  426. newInfo = '按比例;'
  427. _this.fullGiftRuleList.forEach(item => {
  428. newInfo += `<div>购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue}%为促销品采购额</div>`
  429. })
  430. }
  431. form.ruleInfo = newInfo
  432. _this.spinning = true
  433. promotionSave(form).then(res => {
  434. if (res.status == 200) {
  435. _this.$message.success(res.message)
  436. setTimeout(() => {
  437. _this.isShow = false
  438. _this.$emit('ok')
  439. _this.spinning = false
  440. }, 1000)
  441. } else {
  442. _this.spinning = false
  443. }
  444. })
  445. } else {
  446. return false
  447. }
  448. })
  449. },
  450. // 判断品牌,分类,产品其中一个必填
  451. isJudge (list) {
  452. let flag = null
  453. list.forEach(con => {
  454. if (con.productThisList) {
  455. if (con.productThisList.length > 0) {
  456. flag = false
  457. } else {
  458. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  459. flag = false
  460. } else {
  461. flag = true
  462. }
  463. }
  464. } else {
  465. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  466. flag = false
  467. } else {
  468. flag = true
  469. }
  470. }
  471. })
  472. return flag
  473. },
  474. // 重置表格
  475. resetSearchForm () {
  476. this.form = {
  477. promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
  478. description: '',
  479. gateFlag: '0', // 门槛
  480. gateType: undefined,
  481. gateValue: undefined,
  482. quotaAmount: undefined,
  483. giveRuleType: 'SUM_MONEY',
  484. regularUnit: 'YUAN',
  485. scopeFlag: '1',
  486. gateProductList: undefined,
  487. giftProductList: undefined,
  488. regularProductList: undefined,
  489. gateInfo: undefined,
  490. ruleInfo: undefined
  491. }
  492. this.$nextTick(() => {
  493. this.$refs.ruleForm.resetFields()
  494. this.$refs.cillProduct.reSetTableData()
  495. this.$refs.normalPriceProduct.reSetTableData()
  496. this.scaleNum = 0
  497. })
  498. if (this.form.giveRuleType === 'SUM_MONEY') {
  499. this.$refs.offerProduct.reSetTableData()
  500. } else {
  501. this.fullGiftRuleList.forEach((val, i) => {
  502. this.$refs['offerProduct' + i][0].reSetTableData()
  503. })
  504. }
  505. this.fullGiftRuleList = [{
  506. regularValue: undefined,
  507. promotionValue: undefined
  508. }]
  509. },
  510. // 获取编辑详情
  511. getDetail () {
  512. const _this = this
  513. getRuleDetail({ sn: this.itemSn }).then(res => {
  514. if (res.status == 200) {
  515. this.chooseVal = res.data.gateFlag == '0' ? 'b' : 'a'
  516. const resultObj = res.data
  517. if (resultObj.gateFlag === '1') {
  518. resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
  519. }
  520. if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
  521. _this.fullGiftRuleList = resultObj.giveRuleList
  522. }
  523. // 重新组成保存数据
  524. if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
  525. resultObj.gateProductList = _this.newData(resultObj.gateProductList)
  526. this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
  527. }
  528. if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
  529. resultObj.regularProductList = _this.newData(resultObj.regularProductList)
  530. this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
  531. }
  532. if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
  533. resultObj.giftProductList = _this.newData(resultObj.giftProductList)
  534. this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
  535. }
  536. this.form = { ...this.form, ...resultObj }
  537. }
  538. })
  539. },
  540. newData (list) {
  541. list.forEach(con => {
  542. // 品牌
  543. if (con.productBrandList) {
  544. const brandList = []
  545. con.productBrandList.forEach(item => {
  546. item.brandName = item.productBrandName
  547. const brandObj = {
  548. productBrandSn: item.productBrandSn
  549. }
  550. brandList.push(brandObj)
  551. })
  552. con.productBrandArr = con.productBrandList
  553. con.productBrandList = brandList
  554. }
  555. // 分类
  556. if (con.productTypeList) {
  557. const typeList = []
  558. con.productTypeList.forEach(item => {
  559. const typeObj = {}
  560. item.title = ''
  561. const num = 3
  562. for (var i = 0; i < num; i++) {
  563. if (item['productTypeName' + (i + 1)]) {
  564. // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
  565. typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
  566. }
  567. }
  568. // item.title = item.title.slice(0, item.title.length - 1)
  569. if (item.productTypeName3) {
  570. item.title = item.productTypeName2 + '/' + item.productTypeName3
  571. } else if (!item.productTypeName3 && item.productTypeName2) {
  572. item.title = item.productTypeName2
  573. } else {
  574. item.title = item.productTypeName1
  575. }
  576. item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
  577. typeList.push(typeObj)
  578. })
  579. con.productTypeArr = con.productTypeList
  580. con.productTypeList = typeList
  581. }
  582. // 产品
  583. if (con.productThisList) {
  584. const productList = []
  585. con.productThisList.forEach(item => {
  586. const productObj = {
  587. productCode: item.productCode,
  588. productSn: item.productSn
  589. }
  590. productList.push(productObj)
  591. })
  592. con.productThisList = productList
  593. }
  594. })
  595. return list
  596. }
  597. },
  598. watch: {
  599. // 父页面传过来的弹框状态
  600. openModal (newValue, oldValue) {
  601. this.isShow = newValue
  602. },
  603. // 重定义的弹框状态
  604. isShow (newValue, oldValue) {
  605. if (!newValue) {
  606. this.$emit('close')
  607. this.resetSearchForm()
  608. } else {
  609. if (this.itemSn) {
  610. this.getDetail()
  611. } else {
  612. this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
  613. }
  614. }
  615. }
  616. }
  617. }
  618. </script>
  619. <style lang="less" scoped>
  620. .promotionList-basicInfo-modal{
  621. /deep/.ant-modal-body {
  622. padding: 20px 30px;
  623. max-height: 745px !important;
  624. overflow-y: scroll !important;
  625. }
  626. .fixWidthBox .ant-radio-button-wrapper{
  627. width:80px;
  628. text-align: center;
  629. }
  630. .ant-form-item{
  631. margin-bottom:5px;
  632. }
  633. .buyerBox{
  634. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  635. }
  636. .btn-cont {
  637. text-align: center;
  638. margin: 35px 0 10px;
  639. }
  640. .flex{
  641. display:flex;
  642. align-items:center;
  643. justify-content:space-between;
  644. }
  645. }
  646. </style>