specialOfferModal.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  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. this.form.gateType = undefined
  221. this.form.gateAmount = undefined
  222. this.form.quotaAmount = undefined
  223. }
  224. },
  225. // 保存
  226. handleSave () {
  227. const _this = this
  228. this.$refs.ruleForm.validate(valid => {
  229. if (valid) {
  230. // 验证必填
  231. if (_this.form.gateFlag == '1') {
  232. if (!_this.form.gateType) {
  233. _this.$message.warning('请选择规则门槛设置类型!')
  234. return
  235. }
  236. if (!_this.form.gateAmount) {
  237. _this.$message.warning('规则门槛条件不能为空!')
  238. return
  239. }
  240. if (_this.form.gateType === 'FIXED_AMOUNT' && !_this.form.quotaAmount) {
  241. _this.$message.warning('规则门槛条件不能为空!')
  242. return
  243. }
  244. }
  245. if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
  246. _this.$message.warning('请输入订单起订限制金额数!')
  247. return
  248. }
  249. if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
  250. _this.$message.warning('请输入活动经费上限金额!')
  251. return
  252. }
  253. const form = JSON.parse(JSON.stringify(_this.form))
  254. if (form.gateFlag == '1') {
  255. form.gateProductList = _this.$refs.cillProduct.getResultVal()
  256. form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
  257. if (form.gateProductList.length == 0) {
  258. _this.$message.warning('请添加门槛产品!')
  259. return
  260. } else {
  261. const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
  262. if (qtyFlag) {
  263. _this.$message.warning('订单起订量设置不能为空!')
  264. return
  265. }
  266. const rowFlag = _this.isJudge(form.gateProductList)
  267. if (rowFlag) {
  268. _this.$message.warning('请选择产品分类、品牌或产品!')
  269. return
  270. }
  271. }
  272. } else {
  273. form.gateProductList = []
  274. form.gateAmount = ''
  275. form.quotaAmount = ''
  276. form.gateType = undefined
  277. }
  278. form.specialProductList = _this.$refs.specialProduct.getResultVal()
  279. if (form.specialProductList.length == 0) {
  280. _this.$message.warning('请添加特价产品!')
  281. return
  282. } else {
  283. // 为空判断
  284. const isTypeEmpty = form.specialProductList.some(item => (item.productTypeList && item.productTypeList.length == 0) && (item.productBrandList && item.productBrandList.length == 0))
  285. if (isTypeEmpty) {
  286. _this.$message.warning('产品分类或品牌不能为空!')
  287. return
  288. }
  289. const isNumEmpty = form.specialProductList.some(item => (!item.unitType || !item.unitQty))
  290. if (isNumEmpty) {
  291. _this.$message.warning('订单起订量设置不能为空!')
  292. return
  293. }
  294. const isCountEmpty = _this.isNumEmpty(form.specialProductList)
  295. const isMoneyEmpty = _this.isNumEmpty(form.specialProductList)
  296. if (isCountEmpty.flag) {
  297. _this.$message.warning('折扣不能为空!')
  298. return
  299. }
  300. if (isCountEmpty.flag1) {
  301. _this.$message.warning('折扣金额不能为空!')
  302. return
  303. }
  304. }
  305. form.promotionSn = _this.promotionSn
  306. _this.spinning = true
  307. promotionSave(form).then(res => {
  308. if (res.status == 200) {
  309. _this.$message.success(res.message)
  310. setTimeout(() => {
  311. _this.isShow = false
  312. _this.$emit('ok')
  313. _this.spinning = false
  314. }, 1000)
  315. } else {
  316. _this.spinning = false
  317. }
  318. })
  319. } else {
  320. return false
  321. }
  322. })
  323. },
  324. isNumEmpty (dataList) {
  325. const arr = []
  326. const arr1 = []
  327. dataList.forEach(item => {
  328. if (item.dataSourceOrigin === '0') { // 判断分类品牌
  329. if (!item.provinceDiscountRate || !item.cityDiscountRate || !item.specialDiscountRate) {
  330. arr.push(item.productScopeSn)
  331. }
  332. } else {
  333. if (!item.cityDiscountPrice || !item.provinceDiscountPrice || !item.specialDiscountPrice) {
  334. arr1.push(item.productScopeSn)
  335. }
  336. }
  337. })
  338. return { flag: arr.length > 0, flag1: arr1.length > 0 }
  339. },
  340. // 判断门槛产品中品牌,分类,产品其中一个必填
  341. isJudge (list) {
  342. const flag = list.some(con => {
  343. if (con.productThisList) {
  344. if (con.productThisList.length > 0) {
  345. return false
  346. } else {
  347. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  348. return false
  349. } else {
  350. return true
  351. }
  352. }
  353. } else {
  354. if ((con.productTypeList && con.productTypeList.length > 0) || (con.productBrandList && con.productBrandList.length > 0)) {
  355. return false
  356. } else {
  357. return true
  358. }
  359. }
  360. })
  361. return flag
  362. },
  363. // 重置表格
  364. resetSearchForm () {
  365. this.form = {
  366. promotionRuleType: 'PROMO_PROD', // 特价产品
  367. description: '',
  368. gateFlag: '0', // 门槛
  369. gateType: undefined,
  370. gateAmount: undefined,
  371. quotaAmount: undefined,
  372. minOrderFlag: '1', // 起订金额
  373. minOrderAmount: undefined,
  374. upperLimitFlag: '1', // 活动经费上限
  375. upperLimitAmount: undefined,
  376. gateProductList: undefined,
  377. specialProductList: undefined
  378. }
  379. this.$nextTick(() => {
  380. this.$refs.ruleForm.resetFields()
  381. this.$refs.cillProduct.reSetTableData()
  382. this.$refs.specialProduct.reSetTableData()
  383. })
  384. },
  385. // 获取编辑详情
  386. getDetail () {
  387. const _this = this
  388. getRuleDetail({ sn: this.itemSn }).then(res => {
  389. if (res.status == 200) {
  390. this.chooseVal = res.data.gateFlag == '0' ? 'd' : 'a'
  391. const resultObj = res.data
  392. if (resultObj.gateFlag === '1') {
  393. resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
  394. }
  395. // 重新组成保存数据
  396. if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
  397. resultObj.gateProductList = _this.newData(resultObj.gateProductList)
  398. this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
  399. }
  400. if (resultObj.specialProductList && resultObj.specialProductList.length > 0) {
  401. resultObj.specialProductList = _this.newData(resultObj.specialProductList)
  402. this.$refs.specialProduct.setSourceData(resultObj.specialProductList)
  403. }
  404. this.form = { ...this.form, ...resultObj }
  405. }
  406. })
  407. },
  408. newData (list) {
  409. list.forEach(con => {
  410. // 品牌
  411. if (con.productBrandList) {
  412. const brandList = []
  413. con.productBrandList.forEach(item => {
  414. item.brandName = item.productBrandName
  415. const brandObj = {
  416. productBrandSn: item.productBrandSn
  417. }
  418. brandList.push(brandObj)
  419. })
  420. con.productBrandArr = con.productBrandList
  421. con.productBrandList = brandList
  422. }
  423. // 分类
  424. if (con.productTypeList) {
  425. const typeList = []
  426. con.productTypeList.forEach(item => {
  427. const typeObj = {}
  428. item.title = ''
  429. const num = 3
  430. for (var i = 0; i < num; i++) {
  431. if (item['productTypeName' + (i + 1)]) {
  432. // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
  433. typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
  434. }
  435. }
  436. // item.title = item.title.slice(0, item.title.length - 1)
  437. if (item.productTypeName3) {
  438. item.title = item.productTypeName2 + '/' + item.productTypeName3
  439. } else if (!item.productTypeName3 && item.productTypeName2) {
  440. item.title = item.productTypeName2
  441. } else {
  442. item.title = item.productTypeName1
  443. }
  444. item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
  445. typeList.push(typeObj)
  446. })
  447. con.productTypeArr = con.productTypeList
  448. con.productTypeList = typeList
  449. }
  450. // 产品
  451. if (con.productThisList) {
  452. const productList = []
  453. con.productThisList.forEach(item => {
  454. const productObj = {
  455. productCode: item.productCode,
  456. productSn: item.productSn
  457. }
  458. productList.push(productObj)
  459. })
  460. con.productThisList = productList
  461. }
  462. })
  463. return list
  464. },
  465. // 导入
  466. hanldeOk (arr) {
  467. // 门槛产品导入
  468. const resultArr = []
  469. if (this.chooseVal == 'a') {
  470. arr.forEach(item => {
  471. const obj = {
  472. productCode: item.productCode,
  473. productSn: item.product.productSn
  474. }
  475. resultArr.push(obj)
  476. })
  477. const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
  478. this.$refs[name + 'Product'].importRow(resultArr)
  479. } else {
  480. // 特价产品导入
  481. const dataList = this.setShowData('This')
  482. arr.forEach(item => {
  483. item = { ...item, ...item.product }
  484. item.code = item.productCode
  485. if (item.provincePrice) {
  486. item.provinceDiscountRate = Math.floor(((item.provinceDiscountPriceText / item.provincePrice) * 100).toFixed(2))
  487. }
  488. if (item.cityPrice) {
  489. item.cityDiscountRate = Math.floor(((item.cityDiscountPriceText / item.cityPrice) * 100).toFixed(2))
  490. }
  491. if (item.specialPrice) {
  492. item.specialDiscountRate = Math.floor(((item.specialDiscountPriceText / item.specialPrice) * 100).toFixed(2))
  493. }
  494. const flag = dataList.includes(item.productSn)
  495. if (!flag) {
  496. resultArr.push(item)
  497. }
  498. })
  499. if (resultArr.length > 0) {
  500. this.handleProductsOk(resultArr)
  501. } else {
  502. this.$message.warning('请勿添加重复数据!')
  503. }
  504. }
  505. },
  506. // 打开新增产品弹窗(禁用已选)
  507. addProducts () {
  508. this.chooseProducts = []
  509. this.openProductsModal = true
  510. const dataList = this.setShowData('This')
  511. this.$refs.productBox.handleDisabled(dataList)
  512. },
  513. // 获取回显禁用数据
  514. setShowData (name) {
  515. const _this = this
  516. const snArr = []
  517. const valList = _this.$refs.specialProduct.getResultVal()
  518. valList.forEach(item => {
  519. if (item['product' + name + 'List'] && item['product' + name + 'List'].length > 0) {
  520. item['product' + name + 'List'].forEach(con => {
  521. const newName = name === 'This' ? '' : name
  522. snArr.push(con['product' + newName + 'Sn'])
  523. })
  524. }
  525. })
  526. return snArr
  527. },
  528. handleProductsAdd (con) {
  529. debugger
  530. const newArr = []
  531. con.forEach(newCon => {
  532. if (!newCon.provincePrice || !newCon.cityPrice || !newCon.specialPrice) {
  533. newArr.push(newCon.code)
  534. }
  535. })
  536. con.map((list, pos) => {
  537. if (!list.provincePrice || !list.cityPrice || !list.specialPrice) {
  538. con.splice(pos, 1)
  539. }
  540. })
  541. const _this = this
  542. if (newArr && newArr.length > 0) {
  543. _this.$info({
  544. title: '提示',
  545. content: newArr.toString() + '(产品编码),没有定价,不可添加',
  546. closable: true,
  547. centered: true,
  548. onOk () {
  549. _this.handleProductsOk(con)
  550. }
  551. })
  552. } else {
  553. _this.handleProductsOk(con)
  554. }
  555. },
  556. // +新增产品
  557. handleProductsOk (con) {
  558. const _this = this
  559. con.forEach(async (item) => {
  560. const chooseProductsList = []
  561. const getSn = await getNewScopeSn({})
  562. if (getSn.status == 200) {
  563. const newData = {
  564. productScopeSn: getSn.data,
  565. dataSourceOrigin: '1',
  566. productTypeArr: [],
  567. productTypeList: [],
  568. productBrandArr: [{ productBrandSn: item.productBrandSn, brandName: item.productBrandName }],
  569. productBrandList: [{ productBrandSn: item.productBrandSn }],
  570. productThisList: [{
  571. productSn: item.productSn,
  572. productCode: item.code
  573. }],
  574. provincePrice: item.provincePrice,
  575. cityPrice: item.cityPrice,
  576. specialPrice: item.specialPrice,
  577. provinceDiscountPrice: item.provinceDiscountPriceText,
  578. cityDiscountPrice: item.cityDiscountPriceText,
  579. specialDiscountPrice: item.specialDiscountPriceText,
  580. unitType: 'SL',
  581. unitQty: 1,
  582. provinceDiscountRate: item.provinceDiscountRate ? item.provinceDiscountRate : undefined,
  583. cityDiscountRate: item.cityDiscountRate ? item.cityDiscountRate : undefined,
  584. specialDiscountRate: item.specialDiscountRate ? item.specialDiscountRate : undefined
  585. }
  586. const obj = {}
  587. if (item.productTypeSn1) {
  588. obj.productTypeSn1 = item.productTypeSn1
  589. }
  590. if (item.productTypeSn2) {
  591. obj.productTypeSn2 = item.productTypeSn2
  592. }
  593. if (item.productTypeSn3) {
  594. obj.productTypeSn3 = item.productTypeSn3
  595. }
  596. const newObj = { ...obj, ...{} }
  597. if (Object.keys(obj).length == 1) {
  598. newObj.title = item.productTypeName1
  599. newObj.id = item.productTypeSn1
  600. } else if (Object.keys(obj).length == 2) {
  601. newObj.title = item.productTypeName2
  602. newObj.id = item.productTypeSn2
  603. } else {
  604. newObj.title = item.productTypeName2 + '/' + item.productTypeName3
  605. newObj.id = item.productTypeSn3
  606. }
  607. newData.productTypeList[0] = obj
  608. newData.productTypeArr[0] = newObj
  609. chooseProductsList.push(newData)
  610. }
  611. _this.$refs.specialProduct.setSourceData(chooseProductsList)
  612. })
  613. }
  614. },
  615. watch: {
  616. // 父页面传过来的弹框状态
  617. openModal (newValue, oldValue) {
  618. this.isShow = newValue
  619. },
  620. // 重定义的弹框状态
  621. isShow (newValue, oldValue) {
  622. if (!newValue) {
  623. this.$emit('close')
  624. this.resetSearchForm()
  625. } else {
  626. if (this.itemSn) {
  627. this.getDetail()
  628. } else {
  629. this.chooseVal = this.form.gateFlag == '0' ? 'd' : 'a'
  630. }
  631. }
  632. }
  633. }
  634. }
  635. </script>
  636. <style lang="less" scoped>
  637. .promotionList-basicInfo-modal{
  638. /deep/.ant-modal-body {
  639. padding: 40px 40px 24px;
  640. max-height: 745px !important;
  641. overflow-y: scroll !important;
  642. }
  643. .ant-radio-button-wrapper{
  644. width:80px;
  645. text-align: center;
  646. }
  647. .ant-form-item{
  648. margin-bottom:5px;
  649. }
  650. .buyerBox{
  651. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  652. }
  653. .btn-cont {
  654. text-align: center;
  655. margin: 35px 0 10px;
  656. }
  657. .flex{
  658. display:flex;
  659. align-items:center;
  660. justify-content:space-between;
  661. }
  662. }
  663. </style>