detailModal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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="70%">
  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.gateFlag">
  22. <div v-if="form.gateFlag=== '0'">无</div>
  23. <div v-if="form.gateFlag==='1'">
  24. <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额{{ form.gateAmount*100 }}%作为配额 </span>
  25. <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额{{ form.gateAmount }}元,不限制配额。</span>
  26. <span v-if="form.gateType==='FIXED_AMOUNT'">购买满{{ form.gateAmount }}元门槛产品,可使用{{ form.quotaAmount }}元配额,采购规则中的正价商品(配额算销售额)</span>
  27. </div>
  28. </a-form-model-item>
  29. <!-- 买产品送产品 -->
  30. <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
  31. <span>{{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularQty }}个正价产品,送{{ form.promotionQty }}个促销产品</span>
  32. <span v-if="form.restrictFlag&&form.restrictFlag==1">,限制正价产品款数{{ form.restrictCategory }}</span>
  33. </a-form-model-item>
  34. <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
  35. {{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满{{ form.regularAmount }}元正价产品,送{{ form.giveAmount }}元({{ perCentNum }}%促销品采购额)
  36. </a-form-model-item>
  37. <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">{{ form.accrualFlag==='1'?'是':'否' }}</a-form-model-item>
  38. <a-form-model-item label="金额叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'&&form.accrualFlag">{{ form.accrualFlag==='1'?'是':'否' }}</a-form-model-item>
  39. <a-form-model-item prop="minOrderFlag">
  40. <span slot="label">
  41. <a-tooltip title="What do you want others to call you?">
  42. <a-icon type="info-circle" />
  43. </a-tooltip>
  44. 订单起订金额
  45. </span>
  46. {{ form.minOrderFlag === '1'?'限制':'不限制' }}{{ form.minOrderAmount?form.minOrderAmount+'元':'' }}
  47. </a-form-model-item>
  48. <a-form-model-item prop="upperLimitFlag">
  49. <span slot="label">
  50. <a-tooltip title="What do you want others to call you?">
  51. <a-icon type="info-circle" />
  52. </a-tooltip>
  53. 活动经费上限
  54. </span>
  55. {{ form.upperLimitFlag === '1'?'限制':'不限制' }}{{ form.upperLimitAmount?form.upperLimitAmount+'元' :''}}
  56. </a-form-model-item>
  57. <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">{{ form.regularPromotionSameFlag==='1'?'是':'否' }}</a-form-model-item>
  58. <a-form-model-item label="采购额适用范围" v-if="form.scopeFlag" prop="scopeFlag">{{ form.scopeFlag==='1'?'全部产品':'部分产品' }}</a-form-model-item>
  59. </a-form-model>
  60. <a-card size="small" :bordered="false" class="pages-wrap">
  61. <a-radio-group v-model="chooseVal" button-style="solid">
  62. <a-radio-button value="a" v-show="form.gateFlag==='1'">
  63. 门槛产品
  64. </a-radio-button>
  65. <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
  66. 正价产品
  67. </a-radio-button>
  68. <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'||form.scopeFlag==='0'">
  69. 促销产品
  70. </a-radio-button>
  71. <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
  72. 特价产品
  73. </a-radio-button>
  74. </a-radio-group>
  75. <!-- 列表 -->
  76. <div v-show="chooseVal!='d'">
  77. <a-table
  78. class="sTable"
  79. style="margin-top:10px;max-height:280px;"
  80. ref="table"
  81. size="small"
  82. :rowKey="(record) => record.productScopeSn"
  83. :columns="columns"
  84. :data-source="chooseVal==='a'?form.gateProductList:chooseVal==='b'?form.regularProductList:form.giftProductList"
  85. :scroll="{ y: 500 }"
  86. :pagination="false"
  87. bordered
  88. >
  89. <!-- 产品分类 -->
  90. <template slot="productType" slot-scope="text, record">
  91. <div style="max-height:110px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
  92. <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>
  93. </div>
  94. </template>
  95. <!-- 品牌 -->
  96. <template slot="productBrand" slot-scope="text, record">
  97. <div style="max-height:110px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
  98. <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
  99. </div>
  100. </template>
  101. <!-- 产品 -->
  102. <template slot="product" slot-scope="text, record">
  103. <div style="max-height:110px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
  104. <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
  105. </div>
  106. </template>
  107. <!-- 设置起订量 -->
  108. <template slot="setNum" slot-scope="text, record">
  109. <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
  110. <span>{{ record.unitQty }}</span>
  111. </template>
  112. </a-table>
  113. </div>
  114. <!-- 特价产品 -->
  115. <div v-show="chooseVal=='d'">
  116. <a-table
  117. class="sTable"
  118. style="margin-top:10px;max-height:280px;"
  119. ref="table"
  120. size="small"
  121. :rowKey="(record) => record.productScopeSn"
  122. :columns="specialColumns"
  123. :data-source="form.specialProductList"
  124. :scroll="{ y: 500 }"
  125. :pagination="false"
  126. bordered
  127. >
  128. <!-- 产品分类 -->
  129. <template slot="productType" slot-scope="text, record">
  130. <div style="max-height:100px;overflow-y:scroll;" v-if="record.productTypeList && record.productTypeList.length>0">
  131. <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>
  132. </div>
  133. </template>
  134. <!-- 品牌 -->
  135. <template slot="productBrand" slot-scope="text, record">
  136. <div style="max-height:100px;overflow-y:scroll;" v-if="record.productBrandList && record.productBrandList.length>0">
  137. <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
  138. </div>
  139. </template>
  140. <!-- 产品 -->
  141. <template slot="product" slot-scope="text, record">
  142. <div style="max-height:100px;overflow-y:scroll;" v-if="record.productThisList && record.productThisList.length>0">
  143. <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
  144. </div>
  145. <span v-else>--</span>
  146. </template>
  147. <!-- 设置起订量 -->
  148. <template slot="setNum" slot-scope="text, record">
  149. <span style="margin-right:10px;">{{ record.unitTypeDictValue }}</span>
  150. <span>{{ record.unitQty }}</span>
  151. </template>
  152. </a-table>
  153. </div>
  154. </a-card>
  155. <div class="btn-cont">
  156. <a-button id="dealerPromotions-basicInfo-modal-back" @click="isShow = false">关闭</a-button>
  157. </div>
  158. </a-spin>
  159. </a-modal>
  160. </template>
  161. <script>
  162. import { commonMixin } from '@/utils/mixin'
  163. import { STable } from '@/components'
  164. import { getRuleDetail } from '@/api/promotion'
  165. export default {
  166. name: 'DetailModal',
  167. mixins: [commonMixin],
  168. components: { STable },
  169. props: {
  170. openModal: { // 弹框显示状态
  171. type: Boolean,
  172. default: false
  173. },
  174. itemSn: {
  175. type: String,
  176. default: ''
  177. }
  178. },
  179. data () {
  180. const _this = this
  181. return {
  182. isShow: this.openModal, // 是否打开弹框
  183. spinning: false,
  184. formItemLayout: {
  185. labelCol: { span: 5 },
  186. wrapperCol: { span: 16 }
  187. },
  188. form: {
  189. promotionRuleType: undefined,
  190. gateFlag: undefined, // 门槛
  191. gateAmount: undefined,
  192. quotaAmount: undefined,
  193. regularSameFlag: undefined, // 满赠规则 不同款商品
  194. regularQty: undefined,
  195. promotionQty: undefined,
  196. regularAmount: undefined,
  197. giveAmount: undefined,
  198. restrictFlag: undefined, // 限制正价产品款数
  199. restrictCategory: undefined,
  200. accrualFlag: undefined, // 数量叠加
  201. minOrderFlag: undefined, // 起订金额
  202. minOrderAmount: undefined,
  203. upperLimitFlag: undefined, // 活动经费上限
  204. upperLimitAmount: undefined,
  205. regularPromotionSameFlag: undefined,
  206. productTypeArr: [],
  207. productTypeList: [],
  208. productBrandArr: [],
  209. productBrandList: [],
  210. productThisList: []
  211. },
  212. chooseVal: 'a',
  213. specialColumns: [
  214. { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
  215. { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
  216. { title: '产品', scopedSlots: { customRender: 'product' }, width: '8%', align: 'center' },
  217. { title: '省价原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  218. { title: '省价特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  219. { title: '省价折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  220. { title: '市价原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  221. { title: '市价特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  222. { title: '市价折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  223. { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  224. { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  225. { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
  226. { title: '设置起订量', width: '12%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
  227. ]
  228. }
  229. },
  230. computed: {
  231. columns () {
  232. const _this = this
  233. const arr = [
  234. { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
  235. { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
  236. { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
  237. { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
  238. ]
  239. if (_this.chooseVal == 'c') {
  240. arr.pop()
  241. }
  242. return arr
  243. },
  244. perCentNum () {
  245. return Math.floor(((this.form.giveAmount / this.form.regularAmount) * 100).toFixed(2))
  246. }
  247. },
  248. methods: {
  249. // 重置
  250. resetSearchForm () {
  251. this.form = {
  252. promotionRuleType: undefined,
  253. gateFlag: undefined, // 门槛
  254. gateAmount: undefined,
  255. quotaAmount: undefined,
  256. regularSameFlag: undefined, // 满赠规则 不同款商品
  257. regularQty: undefined,
  258. promotionQty: undefined,
  259. regularAmount: undefined,
  260. giveAmount: undefined,
  261. restrictFlag: undefined, // 限制正价产品款数
  262. restrictCategory: undefined,
  263. accrualFlag: undefined, // 数量叠加
  264. minOrderFlag: undefined, // 起订金额
  265. minOrderAmount: undefined,
  266. upperLimitFlag: undefined, // 活动经费上限
  267. upperLimitAmount: undefined,
  268. regularPromotionSameFlag: undefined
  269. }
  270. },
  271. // 获取列表详情
  272. getDetail () {
  273. getRuleDetail({ sn: this.itemSn }).then(res => {
  274. if (res.status == 200) {
  275. const resultObj = res.data
  276. this.chooseVal = resultObj.gateFlag == '1' ? 'a' : resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
  277. this.form = { ...this.form, ...resultObj }
  278. }
  279. })
  280. }
  281. },
  282. watch: {
  283. // 父页面传过来的弹框状态
  284. openModal (newValue, oldValue) {
  285. this.isShow = newValue
  286. },
  287. // 重定义的弹框状态
  288. isShow (newValue, oldValue) {
  289. if (!newValue) {
  290. this.$emit('close')
  291. this.resetSearchForm()
  292. } else {
  293. this.getDetail()
  294. }
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="less" scoped>
  300. .dealerPromotions-basicInfo-modal{
  301. .ant-modal-body {
  302. padding: 40px 40px 24px;
  303. }
  304. .dealerPromotions-basicInfo-con{
  305. margin-top:10px;
  306. }
  307. .ant-form-item{
  308. margin-bottom:0 !important;
  309. }
  310. .buyerBox{
  311. border:1px solid #d9d9d9;margin-top:10px;border-radius:4px;padding:4px 10px;background:#f2f2f2;max-height:130px;overflow-y:scroll;
  312. }
  313. .btn-cont {
  314. text-align: center;
  315. margin: 35px 0 10px;
  316. }
  317. }
  318. </style>