edit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <div class="promotionEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="promotionEdit-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="promotionEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" />返回列表</a>
  8. <span v-if="$route.params.sn" style="margin: 0 10px 0 20px;color: #666;font-size: 14px;font-weight: 600;">促销名称:{{ promotionName||'--' }}</span>
  9. <a-button
  10. type="link"
  11. class="button-primary"
  12. id="promotionEdit-edit-btn"
  13. @click.stop="handleEdit">
  14. <a-icon type="edit"/>编辑
  15. </a-button>
  16. <a-button type="link" size="small" class="button-default" @click="showDetail=!showDetail">
  17. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  18. </a-button>
  19. </template>
  20. </a-page-header>
  21. <div ref="tableSearch">
  22. <a-card size="small" :bordered="false" class="promotionEditInfo" v-show="showDetail">
  23. <div slot="title">
  24. <span>基础信息</span>
  25. </div>
  26. <div v-if="form">
  27. <a-descriptions>
  28. <a-descriptions-item label="促销名称">{{ form.promoName || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="促销类型">{{ form.promoTypeDictValue || '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="促销时间">
  31. {{ form.promoStartDate }}{{ form.promoStartDate?' ~ ':'' }}{{ form.promoEndDate }}
  32. </a-descriptions-item>
  33. <a-descriptions-item label="排序">{{ (form.sort||form.sort==0)? form.sort: '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="加盟商开关权限">{{ form.dealerOpenFlag=='0'?'否':'是' }}</a-descriptions-item>
  35. <a-descriptions-item label="参与经销商" v-if="form.allDealerFlag=='1'">全部经销商</a-descriptions-item>
  36. <a-descriptions-item label="参与经销商" v-else>
  37. <span v-if="!form.shopPromoDealerList||(form.shopPromoDealerList&&form.shopPromoDealerList.length==0)">--</span>
  38. <div v-else @click="handleSee">共<span class="link-bule">{{ form.shopPromoDealerList.length }}</span>个</div>
  39. </a-descriptions-item>
  40. <a-descriptions-item :span="3" label="封面图片"><img @click="handleCheckImg" :src="form.imageUrl" alt="图片走丢了" width="60" height="60" /></a-descriptions-item>
  41. <a-descriptions-item :span="3" label="促销描述">{{ form.description || '--' }}</a-descriptions-item>
  42. </a-descriptions>
  43. </div>
  44. </a-card>
  45. </div>
  46. <!-- 表单 -->
  47. <a-card :bordered="false" class="promotionEdit-cont">
  48. <a-form-model
  49. id="promotionEdit-form"
  50. ref="ruleForm"
  51. :model="form"
  52. :rules="rules"
  53. :label-col="formItemLayout.labelCol"
  54. :wrapper-col="formItemLayout.wrapperCol"
  55. >
  56. <a-row>
  57. <!-- 买产品送代金券 -->
  58. <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
  59. <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
  60. <a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="validName">
  61. <a-input
  62. id="promotionEdit-validName"
  63. :maxLength="20"
  64. v-model.trim="form.validName"
  65. placeholder="请输入券名称(最多20个字符)"
  66. allowClear />
  67. </a-form-model-item>
  68. </a-col>
  69. <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
  70. <a-form-model-item label="券副标题" :label-col="{span:4}" :wrapper-col="{span:16}">
  71. <a-input
  72. id="promotionEdit-validTitle"
  73. :maxLength="20"
  74. v-model.trim="form.validTitle"
  75. placeholder="请输入券副标题(最多20个字符)"
  76. allowClear />
  77. </a-form-model-item>
  78. </a-col>
  79. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  80. <a-form-model-item label="券有效期" prop="validType">
  81. <v-select
  82. style="width:40%;"
  83. v-model="form.validType"
  84. placeholder="请选择券有效期"
  85. id="promotionEdit-validType"
  86. code="SHOP_PROMO_VALID_TYPE"
  87. @change="handleValidType"
  88. allowClear></v-select>
  89. <a-range-picker
  90. v-show="form.validType==='FIXED'"
  91. style="width:40%;margin-left:10px;"
  92. v-model="timeLimit"
  93. :format="dateFormat"
  94. id="promotionEdit-time"
  95. @change="dateLimitChange"
  96. :disabled-date="disabledDate"
  97. :placeholder="['开始时间', '结束时间']" />
  98. <span style="width:40%;margin-left:10px;" v-show="form.validType==='LIMIT'">
  99. 有效期<a-input-number
  100. style="margin:0 5px;"
  101. v-model="form.validDays"
  102. :step="1"
  103. id="promotionEdit-validDays"
  104. :max="99999999"
  105. :min="1"
  106. :precision="0"/>天
  107. </span>
  108. </a-form-model-item>
  109. </a-col>
  110. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  111. <a-form-model-item label="券适用范围" required>
  112. 全部产品
  113. </a-form-model-item>
  114. </a-col>
  115. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  116. <a-form-model-item label="使用说明" prop="validInfo">
  117. <a-input
  118. v-model="form.validInfo"
  119. type="textarea"
  120. id="promotionEdit-validInfo"
  121. placeholder="请输入使用说明(最多50个字符)"
  122. :maxLength="50" />
  123. </a-form-model-item>
  124. </a-col>
  125. </div>
  126. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  127. <a-form-model-item prop="productNum" :label="pageType==='BUY_PROD_GIVE_PROD'?'满赠规则': pageType==='PROMO_PROD'?'优惠方式':'返券产品'">
  128. <div class="productInfo flex-center">
  129. <div style="width:80%;">
  130. <!-- 买产品送产品 -->
  131. <div v-if="pageType==='BUY_PROD_GIVE_PROD'">
  132. 同款产品买<a-input-number
  133. v-model="conditionValue"
  134. style="margin:0 5px;"
  135. :min="1"
  136. :step="1"
  137. :precision="0"
  138. :max="99999999"
  139. id="promotionEdit-conditionValue"
  140. size="small"/>赠
  141. <a-input-number
  142. v-model="resultValue"
  143. style="margin:0 5px;"
  144. :min="0"
  145. :step="1"
  146. :precision="0"
  147. :max="99999999"
  148. id="promotionEdit-resultValue"
  149. size="small"/>个(数量叠加)
  150. <a-button
  151. type="primary"
  152. id="promotionEdit-addSet-btn"
  153. class="button-primary"
  154. size="small"
  155. @click="handleBatchAdd">批量设置</a-button>
  156. <span>已选 {{ porductChooseTotal || 0 }} 项</span>
  157. </div>
  158. <!-- 特价产品 -->
  159. <div v-if="pageType==='PROMO_PROD'">
  160. <v-select
  161. v-model="form.discountType"
  162. ref="promoState"
  163. id="promotionList-discountType"
  164. code="SHOP_PROMO_DISCOUNT_TYPE"
  165. size="small"
  166. style="width:20%;margin-right:5px;"
  167. @change="handleDiscountType"
  168. placeholder="请选择"
  169. allowClear></v-select>
  170. <span v-if="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '直降':'折扣' }}</span>
  171. <a-input-number
  172. v-model="resultValue"
  173. v-if="form.discountType"
  174. style="width:20%;margin:0 5px;"
  175. :min="0"
  176. :step="1"
  177. :precision="2"
  178. :max="99999999"
  179. id="promotionEdit-resultValue"
  180. size="small"/><span v-show="form.discountType">{{ form.discountType==='STRAIGHT_DOWN'? '元':'%' }}</span>
  181. <a-button
  182. type="primary"
  183. id="promotionEdit-addSet-btn"
  184. class="button-primary"
  185. size="small"
  186. @click="handleBatchAdd">批量设置</a-button>
  187. <span>已选 {{ porductChooseTotal || 0 }} 项</span>
  188. </div>
  189. <!-- 买产品返代金券 -->
  190. <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
  191. 返券金额
  192. <a-input-number
  193. v-model="resultValue"
  194. style="margin:0 5px;"
  195. :min="0"
  196. :step="1"
  197. :precision="2"
  198. :max="99999999"
  199. id="promotionEdit-resultValue"
  200. size="small"/>元
  201. <a-button
  202. type="primary"
  203. id="promotionEdit-addSet-btn"
  204. class="button-primary"
  205. size="small"
  206. @click="handleBatchAdd">批量设置</a-button>
  207. <span>已选 {{ porductChooseTotal || 0 }} 项</span>
  208. </div>
  209. </div>
  210. <div style="width:20%;text-align:right;" >
  211. <a-button type="primary" id="promotionEdit-add-btn" @click="handleChooseProduct" size="small">选择产品</a-button>
  212. </div>
  213. </div>
  214. </a-form-model-item>
  215. </a-col>
  216. <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  217. <div style="width: 83%;margin:0 auto 10px;">
  218. <productTable ref="chooseProductList" @changeSel="v=>porductChooseTotal=v" :promoActiveSn="form.promoSn" :discountType="form.discountType" :activeType="pageType"></productTable>
  219. </div>
  220. </a-col>
  221. </a-row>
  222. </a-form-model>
  223. </a-card>
  224. </a-spin>
  225. <div class="affix-cont">
  226. <a-button
  227. type="primary"
  228. class="button-primary"
  229. :disabled="spinning"
  230. id="productInfoEdit-submit-btn"
  231. size="large"
  232. @click="handleSaveAll"
  233. style="padding: 0 60px;">保存</a-button>
  234. </div>
  235. <!-- 添加产品 -->
  236. <chooseProduct :propmSn="$route.params.sn" :openModal="showProModal" @ok="addProductSuccess" @close="closeProductModal"></chooseProduct>
  237. <!--编辑 促销活动 基础信息 -->
  238. <add-promotion-modal
  239. ref="promotionAddModal"
  240. :openModal="openAddModal"
  241. :typeVal="form.promoType"
  242. :chooseProductNum="form.productNum"
  243. :itemSn="$route.params.sn"
  244. @close="openAddModal=false"
  245. @ok="promotionAddOk" ></add-promotion-modal>
  246. <!-- 参与经销商 -->
  247. <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
  248. <!-- 封面展示 -->
  249. <imgShowModal v-drag ref="checkedImg" :openModal="openCheckedImgModal" @close="openCheckedImgModal=false"></imgShowModal>
  250. </div>
  251. </template>
  252. <script>
  253. import { commonMixin } from '@/utils/mixin'
  254. import moment from 'moment'
  255. // 组件
  256. import { VSelect, Upload } from '@/components'
  257. import Editor from '@/components/WEeditor'
  258. import productTable from './productTable'
  259. import chooseProduct from './chooseProductsModal.vue'
  260. import addPromotionModal from './addPromotionModal'
  261. import lookUpCustomersModal from './lookUpCustomersModal'
  262. import imgShowModal from '@/views/easyPassManagement/shoppingManagement/imgShowModal'
  263. // 接口
  264. import { saveChooseProduct, saveShopPromo, shopPromoDetail } from '@/api/shopPromo'
  265. export default {
  266. name: 'ProductBrandEditModal',
  267. mixins: [commonMixin],
  268. components: { VSelect, Upload, Editor, productTable, chooseProduct, addPromotionModal, lookUpCustomersModal, imgShowModal },
  269. data () {
  270. return {
  271. spinning: false,
  272. // 表单 label 设置
  273. formItemLayout: {
  274. labelCol: { span: 2 },
  275. wrapperCol: { span: 20 }
  276. },
  277. dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
  278. openDealerModal: false, // 打开选择经销商弹窗
  279. pageType: undefined, // 促销类型
  280. showDetail: true, // 是否显示基础信息
  281. openAddModal: false, // 基础信息编辑弹窗
  282. openCheckedImgModal: false, // 查看图片弹窗
  283. // 链接配置内容
  284. form: {
  285. promoType: undefined, // 促销类型
  286. promoName: '', // '促销名称'
  287. time: [], // 促销时间
  288. promoStartDate: undefined, // 促销时间-开始
  289. promoEndDate: undefined, // 促销时间-结束
  290. sort: undefined, // 排序
  291. allDealerFlag: '1', // 全部经销商 1 部分经销商0'
  292. imageUrl: undefined, // 促销封面图
  293. description: '', // '促销描述'
  294. dealerEditFlag: '0', // 加盟商编辑 0否 1是
  295. dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
  296. rangeList: [], // 选择产品列表
  297. discountType: '', // 特价产品 - 优惠方式'
  298. validName: '', // 券名称
  299. validTitle: '', // 券副标题
  300. validBaseType: 'category', // 券生成方式
  301. validType: undefined, // 券有效期类型
  302. validStartDate: undefined, // 券生效时间
  303. validEndDate: undefined, // 券失效时间
  304. validDays: undefined, // 券有效期天数
  305. validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
  306. validInfo: '', // 使用说明
  307. productNum: 0
  308. },
  309. conditionValue: undefined, // 买产品送产品 买
  310. resultValue: undefined, // 买产品送产品 赠 返券金额
  311. porductChooseTotal: 0, // 已选产品总数
  312. timeLimit: [], // 有效期
  313. promotionName: '', // 促销名称
  314. showProModal: false, // 打开产品弹窗
  315. openCustomerModal: false, // 打开参与经销商弹窗
  316. // 表单验证规则
  317. rules: {
  318. rangeList: [{ required: true, message: '请选择促销产品', trigger: 'change' }],
  319. validName: [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
  320. validBaseType: [{ required: true, message: '请选择生成方式', trigger: 'change' }],
  321. validType: [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
  322. productNum: [{ required: true, message: '选择产品不能为空', trigger: 'blur' }]
  323. }
  324. }
  325. },
  326. methods: {
  327. // 查看封面图片
  328. handleCheckImg () {
  329. this.openCheckedImgModal = true
  330. const _this = this
  331. _this.$nextTick(() => {
  332. _this.$refs.checkedImg.pageInit(this.form.imageUrl)
  333. })
  334. },
  335. // 查看参与经销商
  336. handleSee () {
  337. this.openCustomerModal = true
  338. this.$nextTick(() => {
  339. this.$refs.lookUpCustomers.pageInit({ dealerSnList: this.form.dealerSnList || undefined })
  340. })
  341. },
  342. // 编辑
  343. handleEdit () {
  344. this.openAddModal = true
  345. this.form.productNum = this.$refs.chooseProductList.getChooseProductNum()
  346. this.$refs.promotionAddModal.getDetail()
  347. },
  348. promotionAddOk (type) {
  349. const _this = this
  350. // 情况产品列表
  351. if (type == '1') {
  352. _this.$refs.chooseProductList.clearTable()
  353. }
  354. _this.getDetail({ sn: _this.$route.params.sn })
  355. },
  356. // 禁用日期时间
  357. disabledDate (current) {
  358. return current && current < moment().startOf('day')
  359. },
  360. // 有效期
  361. dateLimitChange (date, dateStrings) {
  362. if (dateStrings && dateStrings[0]) {
  363. this.timeLimit = dateStrings
  364. this.form.validStartDate = date.length ? dateStrings[0] + ' 00:00:00' : ''
  365. this.form.validEndDate = date.length ? dateStrings[1] + ' 23:59:59' : ''
  366. } else {
  367. this.timeLimit = []
  368. }
  369. },
  370. // 选择优惠方式 change
  371. async handleDiscountType (val) {
  372. this.form.discountType = val
  373. this.resultValue = undefined
  374. },
  375. // 添加产品
  376. handleChooseProduct () {
  377. this.showProModal = true
  378. },
  379. // 添加产品成功
  380. addProductSuccess (list) {
  381. const productArr = list.map(item => {
  382. const obj = {
  383. promoSn: this.form.promoSn,
  384. shopProductSn: item.shopProductSn,
  385. productSn: item.productSn,
  386. productCode: item.productCode
  387. }
  388. if (this.pageType === 'PROMO_PROD') {
  389. obj.conditionValue = item.conditionValue ? item.conditionValue : item.shopProductPrice
  390. }
  391. return obj
  392. })
  393. saveChooseProduct(productArr).then(res => {
  394. if (res.status == 200) {
  395. if (!res.data) {
  396. this.showProModal = false
  397. // 获取产品列表 有分页
  398. this.$refs.chooseProductList.pageInit()
  399. } else {
  400. const tipArr = res.data ? res.data.split(';') : []
  401. const newTipArr = tipArr.filter(item => { return item != '' })
  402. const _this = this
  403. this.$confirm({
  404. title: '提示',
  405. content: newTipArr.map((item, i) => { return <p>{i * 1 + 1}、{item}</p> }),
  406. centered: true,
  407. okText: '知道了',
  408. cancelText: '取消', // 将cancelText设置为空字符串或去掉该属性可以隐藏取消按钮
  409. cancelButtonProps: {
  410. style: {
  411. display: 'none' // 通过设置样式隐藏取消按钮
  412. }
  413. },
  414. onOk () {
  415. _this.showProModal = false
  416. // 获取产品列表 有分页
  417. _this.$refs.chooseProductList.pageInit()
  418. }
  419. })
  420. }
  421. }
  422. })
  423. },
  424. // 关闭产品弹窗
  425. closeProductModal () {
  426. this.showProModal = false
  427. },
  428. // 返回列表
  429. handleBack () {
  430. this.$router.push({ name: 'promotionalActivities', query: { closeLastOldTab: true } })
  431. },
  432. // 详情
  433. async getDetail (ajaxData) {
  434. const _this = this
  435. const res = await shopPromoDetail(ajaxData)
  436. if (res.status == 200) {
  437. _this.form = { ..._this.form, ...res.data }
  438. _this.form.productNum = 0
  439. if (_this.$route.params.pageType === 'edit') {
  440. _this.pageType = res.data.promoType
  441. _this.promotionName = res.data.promoName
  442. }
  443. // 买产品送代金券
  444. if (_this.form.promoType == 'BUY_PROD_GIVE_VALID' && _this.form.validType == 'FIXED') {
  445. // 固定日期
  446. _this.timeLimit = [res.data.validStartDate, res.data.validEndDate]
  447. }
  448. _this.$nextTick(() => {
  449. _this.$refs.chooseProductList.pageInit()
  450. })
  451. }
  452. },
  453. // 券有效期 change
  454. handleValidType (con) {
  455. this.form.validType = con
  456. if (con === 'FIXED') {
  457. this.form.validDays = undefined
  458. } else {
  459. this.timeLimit = []
  460. this.form.validStartDate = undefined
  461. this.form.validEndDate = undefined
  462. }
  463. },
  464. // 确定保存 验证必填
  465. handleSaveAll () {
  466. const _this = this
  467. // 验证组件必填项
  468. _this.$refs.ruleForm.validate(valid => {
  469. if (valid) {
  470. _this.savePartInfo()
  471. }
  472. })
  473. },
  474. // 保存
  475. savePartInfo (type) {
  476. const _this = this
  477. _this.form.promoType = _this.pageType
  478. var formData = JSON.parse(JSON.stringify(_this.form))
  479. if (formData.promoType === 'BUY_PROD_GIVE_VALID') {
  480. if (formData.validType === 'FIXED') {
  481. if (!formData.validStartDate || !formData.validEndDate) {
  482. _this.$message.warning('请输入券有效期!')
  483. return false
  484. }
  485. } else {
  486. if (!formData.validDays) {
  487. _this.$message.warning('请输入券有效期!')
  488. return false
  489. }
  490. }
  491. }
  492. formData.productNum = _this.$refs.chooseProductList.getChooseProductNum()
  493. if (formData.productNum && formData.productNum == 0) {
  494. _this.$message.warning('请先选择产品!')
  495. return
  496. }
  497. delete formData.productNum
  498. _this.spinning = true
  499. formData.saveType = 'all'
  500. saveShopPromo(formData).then(res => {
  501. if (res.status == 200) {
  502. _this.spinning = false
  503. if (res.data.errorMsg && res.data.errorMsg.length > 0) {
  504. this.$confirm({
  505. title: '提示',
  506. content: res.data.errorMsg.map((item, i) => { return <p>{i * 1 + 1}、{item}</p> }),
  507. centered: true,
  508. okText: '知道了',
  509. cancelText: '取消', // 将cancelText设置为空字符串或去掉该属性可以隐藏取消按钮
  510. cancelButtonProps: {
  511. style: {
  512. display: 'none' // 通过设置样式隐藏取消按钮
  513. }
  514. },
  515. onOk () {
  516. console.log('知道了')
  517. }
  518. })
  519. return
  520. }
  521. _this.$message.success(res.message)
  522. _this.$nextTick(() => {
  523. _this.handleBack()
  524. _this.resetSearchForm()
  525. })
  526. } else {
  527. _this.spinning = false
  528. }
  529. })
  530. },
  531. // 重置
  532. resetSearchForm () {
  533. this.form = {
  534. promoType: undefined, // 促销类型
  535. promoName: '', // '促销名称'
  536. time: [], // 促销时间
  537. promoStartDate: undefined, // 促销时间-开始
  538. promoEndDate: undefined, // 促销时间-结束
  539. sort: undefined, // 排序
  540. allDealerFlag: '1', // 全部经销商 1 部分经销商0'
  541. imageUrl: undefined, // 促销封面图
  542. description: '', // '促销描述'
  543. dealerEditFlag: '0', // 加盟商编辑 0否 1是
  544. dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
  545. rangeList: [], // 选择产品列表
  546. discountType: '', // 特价产品 - 优惠方式'
  547. validName: '', // 券名称
  548. validTitle: '', // 券副标题
  549. validBaseType: 'category', // 券生成方式
  550. validType: undefined, // 券有效期类型
  551. validStartDate: undefined, // 券生效时间
  552. validEndDate: undefined, // 券失效时间
  553. validDays: undefined, // 券有效期天数
  554. validScope: '1', // 券适用范围标记 1-全部 0-指定 死值 1
  555. validInfo: '', // 使用说明
  556. productNum: 0
  557. }
  558. if (this.$refs.ruleForm) {
  559. this.$refs.ruleForm.resetFields()
  560. }
  561. },
  562. // 批量设置
  563. handleBatchAdd () {
  564. if (!this.conditionValue && !this.resultValue) {
  565. this.$message.warning('请输入促销优惠规则!')
  566. return
  567. }
  568. this.$refs.chooseProductList.editMorePrice({ conditionValue: this.conditionValue, resultValue: this.resultValue })
  569. },
  570. // 初始化
  571. pageInit () {
  572. this.form.discountType = ''
  573. this.getDetail({ sn: this.$route.params.sn })
  574. }
  575. },
  576. mounted () {
  577. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  578. this.pageInit()
  579. }
  580. },
  581. activated () {
  582. // 如果是新页签打开,则重置当前页面
  583. if (this.$store.state.app.isNewTab) {
  584. this.pageInit()
  585. }
  586. // 仅刷新列表,不重置页面
  587. if (this.$store.state.app.updateList) {
  588. this.pageInit()
  589. }
  590. },
  591. beforeRouteEnter (to, from, next) {
  592. next(vm => {})
  593. }
  594. }
  595. </script>
  596. <style lang="less" scoped>
  597. .promotionEdit-wrap{
  598. position: relative;
  599. height: 100%;
  600. box-sizing: border-box;
  601. padding-bottom:51px;
  602. .promotionEditInfo{
  603. margin-bottom:10px;
  604. }
  605. .buyerBox{
  606. border:1px solid #d9d9d9;
  607. margin-top:10px;
  608. border-radius:4px;
  609. padding:4px 10px;
  610. background:#f2f2f2;
  611. max-height:130px;
  612. overflow-y:scroll;
  613. scrollbar-width: none;
  614. }
  615. >.ant-spin-nested-loading{
  616. overflow-y: scroll;
  617. height: 100%;
  618. }
  619. /deep/.ant-form-item{
  620. margin-bottom:8px;
  621. }
  622. // .ant-form-item-control
  623. .promotionEdit-cont{
  624. margin-bottom: 10px;
  625. }
  626. // 文本编辑器 工具栏样式换行
  627. .promotionEdit-editor{
  628. .w-e-toolbar{
  629. flex-wrap: wrap;
  630. z-index: 0;
  631. }
  632. }
  633. // 商品图片描述
  634. .upload-desc{
  635. font-size: 12px;
  636. color: #808695;
  637. }
  638. #promotionEdit-attachList{
  639. height: auto;
  640. }
  641. .box{
  642. border:1px solid #d9d9d9;
  643. border-radius:4px;
  644. padding:4px 11px;
  645. color:rgba(0, 0, 0, 0.25);
  646. cursor: not-allowed;
  647. background:#fdfdfd;
  648. }
  649. .affix{
  650. .ant-affix{
  651. z-index: 101;
  652. display:inline-block
  653. }
  654. }
  655. /deep/.ant-radio-disabled + span{
  656. color:#000!important;
  657. }
  658. .tip{
  659. margin-left:10px;
  660. }
  661. .productInfo{
  662. width:100%;
  663. display:flex;
  664. }
  665. #setPromotion-productRange{
  666. /deep/.ant-select-dropdown{
  667. max-height:30vh !important;
  668. }
  669. }
  670. }
  671. </style>