detailModal.vue 15 KB

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