detailModal.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
  320. { title: '市价折扣', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
  321. { title: '特约折扣', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } }
  322. ]
  323. } else if (_this.form.discountType === '2') {
  324. arr = [
  325. { title: '省价直降', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
  326. { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
  327. { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } }
  328. ]
  329. }
  330. return arr
  331. },
  332. // 特加产品表格表头
  333. specialColumns () {
  334. const _this = this
  335. const arr = [
  336. { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
  337. { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
  338. { title: '产品', scopedSlots: { customRender: 'product' }, width: '11%', align: 'center' },
  339. { title: '省级原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  340. { title: '省级特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  341. // { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  342. { title: '市级原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  343. { title: '市级特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  344. // { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  345. { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  346. { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  347. // { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  348. { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
  349. ]
  350. if (_this.form.discountType == '0' || _this.form.discountType == '1') {
  351. arr.splice(5, 0, { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  352. arr.splice(8, 0, { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  353. arr.splice(11, 0, { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
  354. } else {
  355. arr.splice(5, 0, { title: '省价直降金额', dataIndex: 'provinceSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  356. arr.splice(8, 0, { title: '市价直降金额', dataIndex: 'citySubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  357. arr.splice(11, 0, { title: '特约直降金额', dataIndex: 'specialSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
  358. }
  359. return arr
  360. }
  361. },
  362. methods: {
  363. // 重置
  364. resetSearchForm () {
  365. this.form = {
  366. promotionRuleType: undefined,
  367. gateFlag: undefined, // 门槛
  368. gateValue: undefined,
  369. quotaAmount: undefined,
  370. regularSameFlag: undefined, // 满赠规则 不同款商品
  371. regularQty: undefined,
  372. promotionQty: undefined,
  373. regularAmount: undefined,
  374. giveAmount: undefined,
  375. restrictFlag: undefined, // 限制正价产品款数
  376. restrictCategory: undefined,
  377. accrualFlag: undefined, // 数量叠加
  378. minOrderFlag: undefined, // 起订金额
  379. minOrderAmount: undefined,
  380. upperLimitFlag: undefined, // 活动经费上限
  381. upperLimitAmount: undefined,
  382. regularPromotionSameFlag: undefined
  383. }
  384. },
  385. // 获取列表详情
  386. getDetail () {
  387. this.spinning = true
  388. getRuleDetail({ sn: this.itemSn }).then(res => {
  389. this.spinning = false
  390. if (res.status == 200) {
  391. const resultObj = res.data
  392. if (resultObj.gateFlag == '1') {
  393. this.chooseVal = 'a'
  394. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.gateProductList)
  395. } else {
  396. if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_PROD') {
  397. this.chooseVal = 'b'
  398. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
  399. } else if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_MONEY') {
  400. this.chooseVal = 'b'
  401. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.regularProductList)
  402. } else {
  403. this.chooseVal = 'd'
  404. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(res.data.specialProductList)
  405. }
  406. }
  407. this.form = { ...this.form, ...resultObj }
  408. this.setTableData = [{
  409. provinceValue: this.form.provinceValue,
  410. cityValue: this.form.cityValue,
  411. specialValue: this.form.specialValue
  412. }]
  413. }
  414. })
  415. },
  416. // 判断预览按钮是否显示
  417. judgeBtnShow (conData) {
  418. const hasData = conData.some(item => item.productThisList)
  419. return hasData
  420. },
  421. // 获取预览数据
  422. getPreviewList (dataList) {
  423. let newList = []
  424. dataList.forEach(con => {
  425. if (con.productThisList) {
  426. con.productThisList.forEach((item, i) => {
  427. item.unitTypeInfo = con.unitTypeDictValue + con.unitQty
  428. item.productTypeInfo = con.promotionProductType
  429. })
  430. newList = [ ...newList, ...con.productThisList ]
  431. }
  432. })
  433. return newList
  434. },
  435. // 预览
  436. handlePreview () {
  437. const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
  438. const titName = this.chooseVal === 'a' ? '门槛产品' : this.chooseVal === 'b' ? '正价产品' : this.chooseVal === 'd' ? '特价产品' : '促销产品'
  439. if (dataName != 'giftGroup') {
  440. const newPreviewList = this.getPreviewList(this.form[dataName + 'ProductList'])
  441. if (newPreviewList && newPreviewList.length > 0) {
  442. this.previewList = newPreviewList
  443. const resuleObj = {
  444. tit: titName,
  445. promotionRuleSn: this.itemSn,
  446. promotionProductType: newPreviewList[0].productTypeInfo
  447. }
  448. this.$refs.previewModal.pageInit(resuleObj)
  449. }
  450. } else {
  451. // 阶梯数据处理
  452. const stepIndex = this.chooseVal.split('')[1]
  453. if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
  454. const stepPreviewList = this.getPreviewList(this.form.giftProductMap['GIFT' + (stepIndex * 1 + 1)])
  455. this.previewList = stepPreviewList
  456. const resuleObj = {
  457. tit: '促销产品(阶梯' + (stepIndex * 1 + 1) + ')',
  458. promotionRuleSn: this.itemSn,
  459. promotionProductType: stepPreviewList[0].productTypeInfo,
  460. scopeLevel: (stepIndex * 1 + 1)
  461. }
  462. this.$refs.previewModal.pageInit(resuleObj)
  463. }
  464. }
  465. this.openProductModal = true
  466. },
  467. // 关闭产品弹窗
  468. closeProductModal () {
  469. this.previewList = []
  470. this.openProductModal = false
  471. },
  472. // 处理阶梯显示数据
  473. onChange () {
  474. const dataName = this.chooseVal === 'a' ? 'gate' : this.chooseVal === 'b' ? 'regular' : this.chooseVal === 'c' ? 'gift' : this.chooseVal === 'd' ? 'special' : 'giftGroup'
  475. if (dataName != 'giftGroup') {
  476. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form[dataName + 'ProductList'])
  477. } else {
  478. // 阶梯数据处理
  479. const pos = this.chooseVal.split('')[1]
  480. if (this.form.giftProductMap && Object.keys(this.form.giftProductMap).length > 0) {
  481. this.isShowPreview = this.pageType === 'salesPage' ? false : this.judgeBtnShow(this.form.giftProductMap['GIFT' + (pos * 1 + 1)])
  482. }
  483. }
  484. }
  485. },
  486. watch: {
  487. // 父页面传过来的弹框状态
  488. openModal (newValue, oldValue) {
  489. this.isShow = newValue
  490. },
  491. // 重定义的弹框状态
  492. isShow (newValue, oldValue) {
  493. if (!newValue) {
  494. this.$emit('close')
  495. this.resetSearchForm()
  496. } else {
  497. this.getDetail()
  498. }
  499. }
  500. }
  501. }
  502. </script>
  503. <style lang="less" scoped>
  504. .dealerPromotions-basicInfo-modal{
  505. .ant-modal-body {
  506. padding: 40px 40px 24px;
  507. }
  508. .dealerPromotions-basicInfo-con{
  509. margin-top:10px;
  510. }
  511. .ant-form-item{
  512. margin-bottom:0 !important;
  513. }
  514. .buyerBox{
  515. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  516. }
  517. .btn-cont {
  518. text-align: center;
  519. margin: 35px 0 10px;
  520. }
  521. //处理滚动条不显示
  522. .tabBox{
  523. max-height:100px;
  524. overflow-y:scroll;
  525. }
  526. .tabBox::-webkit-scrollbar {
  527. width: 0px;
  528. }
  529. .tabBox::-webkit-scrollbar-track {
  530. background: transparent;
  531. }
  532. .tabBox::-webkit-scrollbar-thumb {
  533. background: transparent;
  534. }
  535. .tabBox::-webkit-scrollbar-button {
  536. display: none;
  537. }
  538. // 设置input 禁用颜色
  539. .ant-form-item-control .ant-input[disabled]{
  540. color:#333333;
  541. background:#ffffff;
  542. }
  543. .ant-radio-button-wrapper-disabled{
  544. color:#333333;
  545. padding:0 16px;
  546. }
  547. .ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked{
  548. background-color: #ed1c24 !important;
  549. color:#ffffff;
  550. padding:0 16px;
  551. }
  552. /deep/.ant-select-disabled .ant-select-selection, .ant-cascader-picker-disabled{
  553. color:#333 !important;
  554. background:#fff;
  555. }
  556. .flex{
  557. display:flex;
  558. align-items:center;
  559. justify-content:space-between;
  560. }
  561. }
  562. </style>