detailModal.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <a-modal
  3. centered
  4. class="dealerPromotions-basicInfo-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="详情"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. width="80%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-form-model
  13. id="dealerPromotions-basicInfo-form"
  14. ref="ruleForm"
  15. :model="form"
  16. :label-col="formItemLayout.labelCol"
  17. :wrapper-col="formItemLayout.wrapperCol" >
  18. <a-form-model-item label="规则简称" v-if="form.description">
  19. {{ form.description }}
  20. </a-form-model-item>
  21. <a-form-model-item label="规则叠加" v-if="form.stackFlag&&form.promotionRuleType !='PROMO_PROD'">
  22. {{ form.stackFlag==='1'?'是':'否' }}
  23. </a-form-model-item>
  24. <a-form-model-item label="规则门槛" v-if="form.gateFlag">
  25. {{ form.gateFlag==='1'?'有':'无' }}
  26. <div v-if="form.gateFlag==='1'">
  27. <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateValue?(form.gateValue*100).toFixed(2):'0.00' }}% 作为配额 </span>
  28. <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ toThousands(form.gateValue) }} 元,不限制配额。</span>
  29. <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType !='PROMO_PROD'">购买满 {{ toThousands(form.gateValue) }} 元门槛产品,可使用 {{ toThousands(form.quotaAmount) }} 元配额,采购规则中的正价商品(配额算销售额)</span>
  30. <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType ==='PROMO_PROD'">购买每满 {{ form.gateUnit==='YUAN'?toThousands(form.gateValue):form.gateValue }} {{ form.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购 {{ form.quotaAmount }} 个特价产品(配额算销售额)</span>
  31. </div>
  32. </a-form-model-item>
  33. <!-- 买产品送产品 -->
  34. <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
  35. <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
  36. <div v-for="item in form.giveRuleList" :key="item.scopeLevel">{{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }} {{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送 {{ item.promotionValue }} 个促销产品</div>
  37. <div v-if="form.restrictFlag&&form.restrictFlag==1">限制正价产品{{ form.restrictCategory }}款 </div>
  38. <div v-if="form.convertExpenseFlag&&form.convertExpenseFlag==1">可转费用报销单</div>
  39. </div>
  40. <span v-else>--</span>
  41. </a-form-model-item>
  42. <!-- 买产品送采购额 -->
  43. <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
  44. <div>{{ form.giveRuleType==='SUM_MONEY'?'金额叠加':'按比例' }}</div>
  45. <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
  46. <div v-if="form.giveRuleType==='SUM_MONEY'">购买满{{ form.giveRuleList[0].regularUnit==='YUAN'?toThousands(form.giveRuleList[0].regularValue):form.giveRuleList[0].regularValue }}{{ form.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ toThousands(form.giveRuleList[0].promotionValue) }}元<span>({{ form.giveRuleList[0].regularUnit==='YUAN'?perCentNum+'%':'' }}促销品采购额)</span></div>
  47. <div v-if="form.giveRuleType==='RATIO' &&form.giveRuleList && form.giveRuleList.length>0 ">
  48. <div v-for="item in form.giveRuleList" :key="item.scopeLevel">
  49. {{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}产品购买满{{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送正价产品总金额的{{ item.promotionValue?item.promotionValue.toFixed(2):'0.00' }}%为促销品采购额
  50. </div>
  51. </div>
  52. </div>
  53. </a-form-model-item>
  54. <a-form-model-item label="产品累计" v-if="form.borrowTimeLimtType">
  55. {{ form.borrowTimeLimtTypeDictValue }}{{ form.borrowedShowFlag==='1'?',加盟商显示“转促”标签':'' }}
  56. </a-form-model-item>
  57. <!-- 特价产品 -->
  58. <a-form-model-item label="特价规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='PROMO_PROD'">
  59. {{ form.discountType==='0'?'手动输入特价':form.discountType==='1'?'各级别价打折':'各级别价直降' }}
  60. <a-table
  61. v-show="form.discountType!=0"
  62. class="sTable"
  63. ref="setTable"
  64. size="small"
  65. :rowKey="(record) => record.regularValue"
  66. rowKeyName="regularValue"
  67. :columns="setColumns"
  68. :data-source="setTableData"
  69. :pagination="false"
  70. style="width:60%;"
  71. bordered>
  72. </a-table>
  73. </a-form-model-item>
  74. <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
  75. {{ form.accrualFlag==='1'?'是':'否' }}
  76. </a-form-model-item>
  77. <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">
  78. {{ form.regularPromotionSameFlag==='1'?'是':'否' }}
  79. </a-form-model-item>
  80. <a-form-model-item label="采购额适用范围" v-if="form.scopeFlag" prop="scopeFlag" >
  81. {{ form.scopeFlag==='1'?'全部产品':'部分产品' }}
  82. </a-form-model-item>
  83. <a-form-model-item label="规则叠加" v-if="form.stackFlag&&form.promotionRuleType==='PROMO_PROD'&&form.discountType!='0'">
  84. {{ form.stackFlag==='1'?'是':'否' }}
  85. </a-form-model-item>
  86. </a-form-model>
  87. <a-card size="small" :bordered="false" class="pages-wrap">
  88. <div class="flex">
  89. <a-radio-group v-model="chooseVal" button-style="solid" id="dealerPromotions-basicInfo-radio" @change="onChange">
  90. <a-radio-button value="a" v-show="form.gateFlag==='1'">
  91. 门槛产品
  92. </a-radio-button>
  93. <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
  94. 正价产品
  95. </a-radio-button>
  96. <a-radio-button value="c" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType!='BUY_PROD_GIVE_PROD'">
  97. 促销产品
  98. </a-radio-button>
  99. <a-radio-button :value="'c'+i" v-for="(item,i) in form.giveRuleList" :key="i" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType=='BUY_PROD_GIVE_PROD'&&form.giveRuleList">
  100. {{ form.giveRuleList.length>1? '促销产品'+'(阶梯'+(i*1+1) +')' :'促销产品' }}
  101. </a-radio-button>
  102. <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
  103. 特价产品
  104. </a-radio-button>
  105. </a-radio-group>
  106. <a-button type="link" v-show="isShowPreview" class="button-info" id="dealerPromotions-basicInfo-preview" @click="handlePreview">预览</a-button>
  107. </div>
  108. <!-- 列表 -->
  109. <div v-show="chooseVal==='a'||chooseVal==='b'||chooseVal==='c'">
  110. <a-table
  111. class="sTable"
  112. style="margin-top:10px;max-height:340px;"
  113. ref="table"
  114. size="small"
  115. :rowKey="(record) => record.productScopeSn"
  116. :columns="columns"
  117. :data-source="chooseVal==='a'?form.gateProductList:chooseVal==='b'?form.regularProductList:form.giftProductList"
  118. :scroll="{ y: 330 }"
  119. :pagination="false"
  120. bordered
  121. >
  122. <!-- 产品分类 -->
  123. <template slot="productType" slot-scope="text, record">
  124. <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
  125. <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
  126. </div>
  127. </template>
  128. <!-- 品牌 -->
  129. <template slot="productBrand" slot-scope="text, record">
  130. <div class="tabBox" v-if="record.productBrandList && record.productBrandList.length>0">
  131. <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
  132. </div>
  133. </template>
  134. <!-- 产品 -->
  135. <template slot="product" slot-scope="text, record">
  136. <div class="tabBox" v-if="record.productThisList && record.productThisList.length>0">
  137. <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
  138. </div>
  139. </template>
  140. <!-- 设置起订量 -->
  141. <template slot="setNum" slot-scope="text, record">
  142. <a-tag style="width:60%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
  143. <a-tag style="width:60%;margin-right:0;">{{ record.unitQty }}</a-tag>
  144. </template>
  145. </a-table>
  146. </div>
  147. <!-- 买产品送产品列表 -->
  148. <div v-if="form.giftProductMap && form.giveRuleList&& form.giveRuleList.length>0">
  149. <div v-for="(con,k) in form.giveRuleList" :key="k" v-show="chooseVal==('c'+k)">
  150. <a-table
  151. class="sTable"
  152. style="margin-top:10px;max-height:340px;"
  153. ref="table"
  154. size="small"
  155. :rowKey="(record) => record.id"
  156. :columns="columns"
  157. :data-source="form.giftProductMap['GIFT'+(k*1+1)]"
  158. :scroll="{ y: 330 }"
  159. :pagination="false"
  160. bordered
  161. >
  162. <!-- 产品分类 -->
  163. <template slot="productType" slot-scope="text, record">
  164. <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
  165. <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
  166. </div>
  167. </template>
  168. <!-- 品牌 -->
  169. <template slot="productBrand" slot-scope="text, record">
  170. <div class="tabBox" v-if="record.productBrandList && record.productBrandList.length>0">
  171. <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
  172. </div>
  173. </template>
  174. <!-- 产品 -->
  175. <template slot="product" slot-scope="text, record">
  176. <div class="tabBox" v-if="record.productThisList && record.productThisList.length>0">
  177. <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
  178. </div>
  179. </template>
  180. <!-- 设置起订量 -->
  181. <template slot="setNum" slot-scope="text, record">
  182. <a-tag style="width:60%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
  183. <a-tag style="width:60%;margin-right:0;">{{ record.unitQty }}</a-tag>
  184. </template>
  185. </a-table>
  186. </div>
  187. </div>
  188. <!-- 特价产品 -->
  189. <div v-show="chooseVal=='d'">
  190. <a-table
  191. class="sTable"
  192. style="margin-top:10px;max-height:340px;"
  193. ref="table"
  194. size="small"
  195. :rowKey="(record) => record.productScopeSn"
  196. :columns="specialColumns"
  197. :data-source="form.specialProductList"
  198. :scroll="{ y: 330 }"
  199. :pagination="false"
  200. bordered
  201. >
  202. <!-- 产品分类 -->
  203. <template slot="productType" slot-scope="text, record">
  204. <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
  205. <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
  206. </div>
  207. </template>
  208. <!-- 品牌 -->
  209. <template slot="productBrand" slot-scope="text, record">
  210. <div class="tabBox" v-if="record.productBrandList && record.productBrandList.length>0">
  211. <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
  212. </div>
  213. </template>
  214. <!-- 产品 -->
  215. <template slot="product" slot-scope="text, record">
  216. <div class="tabBox" v-if="record.productThisList && record.productThisList.length>0">
  217. <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
  218. </div>
  219. <span v-else>--</span>
  220. </template>
  221. <!-- 设置起订量 -->
  222. <template slot="setNum" slot-scope="text, record">
  223. <a-tag style="width:90%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
  224. <a-tag style="width:90%;margin-right:0;">{{ record.unitQty }}</a-tag>
  225. </template>
  226. </a-table>
  227. </div>
  228. </a-card>
  229. <div class="btn-cont">
  230. <a-button id="dealerPromotions-basicInfo-back" @click="isShow = false">关闭</a-button>
  231. </div>
  232. </a-spin>
  233. <!-- 预览弹窗 -->
  234. <productPreviewModal ref="previewModal" :openModal="openProductModal" :dataList="previewList" @close="closeProductModal"></productPreviewModal>
  235. </a-modal>
  236. </template>
  237. <script>
  238. import { commonMixin } from '@/utils/mixin'
  239. // 组件
  240. import productPreviewModal from './productPreviewModal'
  241. // 接口
  242. import { getRuleDetail } from '@/api/promotion'
  243. export default {
  244. name: 'DetailModal',
  245. mixins: [commonMixin],
  246. components: { productPreviewModal },
  247. props: {
  248. openModal: { // 弹框显示状态
  249. type: Boolean,
  250. default: false
  251. },
  252. itemSn: {
  253. type: String,
  254. default: ''
  255. },
  256. pageType: {
  257. type: String,
  258. default: 'promotionsPage'
  259. }
  260. },
  261. data () {
  262. return {
  263. spinning: false,
  264. isShow: this.openModal, // 是否打开弹框
  265. // form表单 label布局
  266. formItemLayout: {
  267. labelCol: { span: 4 },
  268. wrapperCol: { span: 20 }
  269. },
  270. // 提交参数
  271. form: {
  272. promotionRuleType: undefined, // 规则类型 BUY_PROD_GIVE_PROD 买产品送产品 BUY_PROD_GIVE_MONEY 买产品送采购额 PROMO_PROD特价产品
  273. gateFlag: undefined, // 是否有门槛产品
  274. gateValue: undefined, // 门槛产品值
  275. quotaAmount: undefined, // 门槛产品配额值
  276. regularSameFlag: undefined, // 满赠规则 不同款商品
  277. regularQty: undefined,
  278. promotionQty: undefined,
  279. regularAmount: undefined,
  280. giveAmount: undefined,
  281. restrictFlag: undefined, // 是否限制正价产品款数
  282. restrictCategory: undefined, // 正价产品限制款数
  283. accrualFlag: undefined, // 是否数量叠加
  284. minOrderFlag: undefined, // 起订金额
  285. minOrderAmount: undefined,
  286. upperLimitFlag: undefined, // 活动经费上限
  287. upperLimitAmount: undefined,
  288. regularPromotionSameFlag: undefined, // 促销品是否与正品一致 1是 0否
  289. productTypeArr: [], // 所选产品分类(渲染)
  290. productTypeList: [], // 所选产品分类(后台所需数据)
  291. productBrandArr: [], // 所选产品品牌(渲染)
  292. productBrandList: [], // 所选产品品牌(后台所需数据)
  293. productThisList: []// 所选产品
  294. },
  295. chooseVal: 'a', // tab所选列表值
  296. columns: [
  297. { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
  298. { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
  299. { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
  300. { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
  301. ],
  302. isShowPreview: false, // 是否显示预览按钮
  303. openProductModal: false, // 预览弹窗
  304. previewList: []// 预览值
  305. }
  306. },
  307. computed: {
  308. // 计算满赠规则 配额比例
  309. perCentNum () {
  310. const val = (this.form.giveRuleList[0].regularValue && this.form.giveRuleList[0].regularValue != 0) ? ((this.form.giveRuleList[0].promotionValue / this.form.giveRuleList[0].regularValue) * 100).toFixed(2) : '0.00'
  311. return val
  312. },
  313. // 特价产品 判断不同折扣类型显示不同表头
  314. setColumns () {
  315. const _this = this
  316. var arr = []
  317. if (_this.form.discountType === '1') {
  318. arr = [
  319. { title: '特价产品原价金额', dataIndex: 'orginAmountValue', width: '25%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  320. { title: '省价折扣', dataIndex: 'provinceValue', width: '25%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
  321. { title: '市价折扣', dataIndex: 'cityValue', width: '25%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
  322. { title: '特约折扣', dataIndex: 'specialValue', width: '25%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } }
  323. ]
  324. } else if (_this.form.discountType === '2') {
  325. arr = [
  326. { title: '省价直降', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
  327. { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
  328. { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } }
  329. ]
  330. }
  331. return arr
  332. },
  333. // 特加产品表格表头
  334. specialColumns () {
  335. const _this = this
  336. const arr = [
  337. { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
  338. { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
  339. { title: '产品', scopedSlots: { customRender: 'product' }, width: '11%', align: 'center' },
  340. { title: '省级原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  341. { title: '省级特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  342. // { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  343. { title: '市级原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  344. { title: '市级特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  345. // { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  346. { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  347. { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  348. // { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  349. { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
  350. ]
  351. if (_this.form.discountType == '0' || _this.form.discountType == '1') {
  352. arr.splice(5, 0, { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  353. arr.splice(8, 0, { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  354. arr.splice(11, 0, { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  355. } else {
  356. arr.splice(5, 0, { title: '省价直降金额', dataIndex: 'provinceSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  357. arr.splice(8, 0, { title: '市价直降金额', dataIndex: 'citySubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  358. arr.splice(11, 0, { title: '特约直降金额', dataIndex: 'specialSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  359. }
  360. return arr
  361. }
  362. },
  363. methods: {
  364. // 重置
  365. resetSearchForm () {
  366. this.form = {
  367. promotionRuleType: undefined,
  368. gateFlag: undefined, // 门槛
  369. gateValue: undefined,
  370. quotaAmount: undefined,
  371. regularSameFlag: undefined, // 满赠规则 不同款商品
  372. regularQty: undefined,
  373. promotionQty: undefined,
  374. regularAmount: undefined,
  375. giveAmount: undefined,
  376. restrictFlag: undefined, // 限制正价产品款数
  377. restrictCategory: undefined,
  378. accrualFlag: undefined, // 数量叠加
  379. minOrderFlag: undefined, // 起订金额
  380. minOrderAmount: undefined,
  381. upperLimitFlag: undefined, // 活动经费上限
  382. upperLimitAmount: undefined,
  383. regularPromotionSameFlag: undefined
  384. }
  385. },
  386. // 获取列表详情
  387. getDetail () {
  388. this.spinning = true
  389. getRuleDetail({ sn: this.itemSn }).then(res => {
  390. this.spinning = false
  391. if (res.status == 200) {
  392. const resultObj = res.data
  393. if (resultObj.gateFlag == '1') {
  394. this.chooseVal = 'a'
  395. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.gateProductList)
  396. } else {
  397. if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_PROD') {
  398. this.chooseVal = 'b'
  399. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
  400. } else if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_MONEY') {
  401. this.chooseVal = 'b'
  402. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
  403. } else {
  404. this.chooseVal = 'd'
  405. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.specialProductList)
  406. }
  407. }
  408. this.form = { ...this.form, ...resultObj }
  409. // 阶梯
  410. if (resultObj.discountType != '0') {
  411. if (resultObj.discountType == '1' && resultObj.specialDiscountList) {
  412. this.setTableData = resultObj.specialDiscountList.map(item => {
  413. return {
  414. orginAmountValue: item.discountScopePrice,
  415. provinceValue: item.provinceDiscountRate,
  416. cityValue: item.cityDiscountRate,
  417. specialValue: item.specialDiscountRate,
  418. scopeLevel: item.scopeLevel
  419. }
  420. })
  421. } else {
  422. this.setTableData = [{
  423. provinceValue: resultObj.provinceValue,
  424. cityValue: resultObj.cityValue,
  425. specialValue: resultObj.specialValue
  426. }]
  427. }
  428. }
  429. }
  430. })
  431. },
  432. // 判断预览按钮是否显示
  433. judgeBtnShow (conData) {
  434. const hasData = conData.some(item => item.productThisList)
  435. return hasData
  436. },
  437. // 获取预览数据
  438. getPreviewList (dataList) {
  439. let newList = []
  440. dataList.forEach(con => {
  441. if (con.productThisList) {
  442. con.productThisList.forEach((item, i) => {
  443. item.unitTypeInfo = con.unitTypeDictValue + con.unitQty
  444. item.productTypeInfo = con.promotionProductType
  445. })
  446. newList = [ ...newList, ...con.productThisList ]
  447. }
  448. })
  449. return newList
  450. },
  451. // 预览
  452. handlePreview () {
  453. const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
  454. const titName = this.chooseVal === 'a' ? '门槛产品' : this.chooseVal === 'b' ? '正价产品' : this.chooseVal === 'd' ? '特价产品' : '促销产品'
  455. if (dataName != 'giftGroup') {
  456. const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
  457. if (newPreviewList && newPreviewList.length > 0) {
  458. this.previewList = newPreviewList
  459. const resuleObj = {
  460. tit: titName,
  461. promotionRuleSn: this.itemSn,
  462. promotionProductType: newPreviewList[0].productTypeInfo
  463. }
  464. this.$refs.previewModal.pageInit(resuleObj)
  465. }
  466. } else {
  467. // 阶梯数据处理
  468. const stepIndex = this.chooseVal.split('')[1]
  469. if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
  470. const stepPreviewList = this.getPreviewList(this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)])
  471. this.previewList = stepPreviewList
  472. const resuleObj = {
  473. tit: '促销产品(阶梯' + (stepIndex * 1 + 1) + ')',
  474. promotionRuleSn: this.itemSn,
  475. promotionProductType: stepPreviewList[0].productTypeInfo,
  476. scopeLevel: (stepIndex * 1 + 1)
  477. }
  478. this.$refs.previewModal.pageInit(resuleObj)
  479. }
  480. }
  481. this.openProductModal = true
  482. },
  483. // 关闭产品弹窗
  484. closeProductModal () {
  485. this.previewList = []
  486. this.openProductModal = false
  487. },
  488. // 处理阶梯显示数据
  489. onChange () {
  490. const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
  491. if (dataName != 'giftGroup') {
  492. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form[dataName + 'ProductList'])
  493. } else {
  494. // 阶梯数据处理
  495. const pos = this.chooseVal.split('')[1]
  496. if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
  497. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form.giftProductMap['GIFT' + (pos * 1 + 1)])
  498. }
  499. }
  500. }
  501. },
  502. watch: {
  503. // 父页面传过来的弹框状态
  504. openModal (newValue, oldValue) {
  505. this.isShow = newValue
  506. },
  507. // 重定义的弹框状态
  508. isShow (newValue, oldValue) {
  509. if (!newValue) {
  510. this.$emit('close')
  511. this.resetSearchForm()
  512. } else {
  513. this.getDetail()
  514. }
  515. }
  516. }
  517. }
  518. </script>
  519. <style lang="less" scoped>
  520. .dealerPromotions-basicInfo-modal{
  521. .ant-modal-body {
  522. padding: 40px 40px 24px;
  523. }
  524. .dealerPromotions-basicInfo-con{
  525. margin-top:10px;
  526. }
  527. .ant-form-item{
  528. margin-bottom:0 !important;
  529. }
  530. .buyerBox{
  531. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  532. }
  533. .btn-cont {
  534. text-align: center;
  535. margin: 35px 0 10px;
  536. }
  537. //处理滚动条不显示
  538. .tabBox{
  539. max-height:100px;
  540. overflow-y:scroll;
  541. }
  542. .tabBox::-webkit-scrollbar {
  543. width: 0px;
  544. }
  545. .tabBox::-webkit-scrollbar-track {
  546. background: transparent;
  547. }
  548. .tabBox::-webkit-scrollbar-thumb {
  549. background: transparent;
  550. }
  551. .tabBox::-webkit-scrollbar-button {
  552. display: none;
  553. }
  554. // 设置input 禁用颜色
  555. .ant-form-item-control .ant-input[disabled]{
  556. color:#333333;
  557. background:#ffffff;
  558. }
  559. .ant-radio-button-wrapper-disabled{
  560. color:#333333;
  561. padding:0 16px;
  562. }
  563. .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked{
  564. background-color: #ed1c24 !important;
  565. color:#ffffff;
  566. padding:0 16px;
  567. }
  568. /deep/.ant-select-disabled .ant-select-selection, .ant-cascader-picker-disabled{
  569. color:#333 !important;
  570. background:#fff;
  571. }
  572. .flex{
  573. display:flex;
  574. align-items:center;
  575. justify-content:space-between;
  576. }
  577. }
  578. </style>