specialOfferModal.vue 24 KB

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