detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div class="promotionDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="promotionDetail-cont" style="padding:16px 24px;">
  5. <template slot="subTitle">
  6. <a href="javascript:;" id="promotionDetail-back" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  7. <span style="margin: 0 10px 0 20px;color: #666;font-size: 14px;font-weight: 600;">促销名称:{{ detailData&&detailData.title||'--' }}</span>
  8. <a-button type="link" class="button-default" id="promotionDetail-showInfo" @click="isShowBisiceInfo=!isShowBisiceInfo">
  9. <a-icon :type="isShowBisiceInfo ? 'eye-invisible' : 'eye'"/> {{ isShowBisiceInfo?'隐藏':'查看' }}信息
  10. </a-button>
  11. </template>
  12. </a-page-header>
  13. <!-- 基础信息 -->
  14. <a-card size="small" title="基础信息" :bordered="false" v-show="!isShowBisiceInfo" class="promotionDetail-cont">
  15. <a-descriptions size="small" v-if="detailData">
  16. <a-descriptions-item label="促销名称">{{ detailData.title || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="促销简称">{{ detailData.description || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="促销时间" v-if="detailData.promotionDateStart&& detailData.promotionDateEnd">{{ detailData.promotionDateStart }}-{{ detailData.promotionDateEnd }}</a-descriptions-item>
  19. <a-descriptions-item label="促销时间" v-else>--</a-descriptions-item>
  20. <a-descriptions-item label="审核通过时间">{{ detailData.auditDate||'--' }}</a-descriptions-item>
  21. <a-descriptions-item label="费用所属部门">{{ detailData.expenseDepartmentName || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="参与客户" v-if="detailData.dealerScope!='ALL_DEALER'"><div @click="handleSee">共<span class="link-bule">{{ detailData.dealerQty }}</span>个</div></a-descriptions-item>
  23. <a-descriptions-item label="参与客户" v-else>全部客户</a-descriptions-item>
  24. <a-descriptions-item label="最大参与次数">{{ detailData.dealerMaxJoinFlag=='1' ? detailData.dealerMaxJoinQty :'不限' }}</a-descriptions-item>
  25. <a-descriptions-item label="活动订单起订金额(元)">{{ detailData.minOrderFlag ==='0'?'不限':detailData.minOrderAmount?toThousands(detailData.minOrderAmount):'--' }}</a-descriptions-item>
  26. <a-descriptions-item label="活动经费上限(元)":span="2">{{ detailData.upperLimitFlag ==='0'?'不限':detailData.upperLimitAmount? toThousands(detailData.upperLimitAmount):'--' }}</a-descriptions-item>
  27. <a-descriptions-item label="促销描述" :span="3">
  28. <div class="descItem">{{ detailData.content || '--' }}</div>
  29. </a-descriptions-item>
  30. <a-descriptions-item label="终止说明" :span="3" v-if="detailData.state === 'IS_OVER'&&detailData.overInfo">{{ detailData.overInfo }}</a-descriptions-item>
  31. <a-descriptions-item label="附件" :span="3">
  32. <div class="attachmentBox" v-if="detailData.attachmentList&&detailData.attachmentList.length>0">
  33. <a
  34. id="promotionDetail-downloadFile"
  35. class="link-bule"
  36. target="downloadFile"
  37. :href="item.filePath"
  38. v-for="item in detailData.attachmentList"
  39. :key="item.id"
  40. download>{{ item.fileName }}</a>
  41. </div>
  42. <span v-else>--</span>
  43. </a-descriptions-item>
  44. </a-descriptions>
  45. </a-card>
  46. <a-card size="small" title="规则设置" :bordered="false" class="pages-wrap">
  47. <div class="btnGroup" v-if="$hasPermissions('B_rulesAddEdit')&&$route.query.type=='rule'">
  48. <a-button type="primary" class="button-info" id="promotionDetail-sendProducts" @click="openBtnModal('SendProducts')" :disabled="disabled">买产品送产品</a-button>
  49. <a-button type="primary" class="button-info" id="promotionDetail-sendAmount" @click="openBtnModal('SendAmount')" :disabled="disabled">买产品送采购额</a-button>
  50. <a-button type="primary" style="margin-left:5px;" id="promotionDetail-specialOffer" @click="openBtnModal('SpecialOffer')" :disabled="disabled">特价产品</a-button>
  51. </div>
  52. <!-- 列表 -->
  53. <s-table
  54. class="sTable"
  55. ref="table"
  56. size="small"
  57. :rowKey="(record) => record.id"
  58. :columns="columns"
  59. :data="loadData"
  60. :defaultLoadData="false"
  61. :showPagination="false"
  62. :scroll="{ y: !isShowBisiceInfo?365:568}"
  63. bordered>
  64. <!-- 门槛规则 -->
  65. <template slot="cillProduct" slot-scope="text, record">
  66. <div v-if="record.gateFlag === '1'">
  67. <span v-if="record.gateType==='RATIO_AMOUNT'">
  68. 购买门槛产品金额{{ record.gateValue?(record.gateValue*100).toFixed(2) :'0.00' }}%作为配额
  69. </span>
  70. <span v-else-if="record.gateType==='MIN_AMOUNT'">
  71. 购买门槛产品满最低金额{{ toThousands(record.gateValue) }}元,不限制配额
  72. </span>
  73. <span v-else>
  74. <span v-if="record.promotionRuleType!='PROMO_PROD'">购买满{{ toThousands(record.gateValue) }}元门槛产品,可使用 {{ toThousands(record.quotaAmount) }}元配额,采购规则中的正价商品</span>
  75. <span v-else>购买每满{{ record.gateUnit==='YUAN'? toThousands(record.gateValue):record.gateValue }}{{ record.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购{{ record.quotaAmount }}个特价产品</span>
  76. </span>
  77. </div>
  78. <span v-else>无</span>
  79. </template>
  80. <!-- 规则 -->
  81. <template slot="ruleProduct" slot-scope="text, record">
  82. <div v-html="record.ruleInfo"></div>
  83. <!-- <div v-if="record.promotionRuleType == 'BUY_PROD_GIVE_PROD'">
  84. <div>{{ record.stackFlag==='1'?'规则叠加;':'' }}{{ record.accrualFlag==='1'?'数量叠加;':'' }}{{ record.convertExpenseFlag==='1'?'可转费用报销单;':'' }}</div>
  85. <div v-if="record.giveRuleList && record.giveRuleList.length>0">
  86. <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
  87. {{ record.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品,购买满{{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ item.promotionValue }}个促销产品;
  88. </div>
  89. </div>
  90. <div v-if="record.restrictFlag==='1'">限制正价产品{{ record.restrictCategory }}款;</div>
  91. <div v-if="record.borrowTimeLimtType">产品累计:{{ record.borrowTimeLimtTypeDictValue }}<span v-if="record.borrowedShowFlag==='1'">,加盟商显示“转促”标签;</span></div>
  92. </div>
  93. <div v-else-if="record.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
  94. <div v-if="record.stackFlag==='1'">规则叠加;</div>
  95. <div v-if="record.giveRuleList&&record.giveRuleList.length>0">
  96. <div v-if="record.giveRuleType==='SUM_MONEY'">金额叠加;购买满{{ record.giveRuleList[0].regularUnit==='YUAN'?toThousands(record.giveRuleList[0].regularValue):record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ toThousands(record.giveRuleList[0].promotionValue) }}元<span v-if="record.giveRuleList[0].regularUnit==='YUAN'">({{ record.giveRuleList[0].regularValue!=0?((record.giveRuleList[0].promotionValue/record.giveRuleList[0].regularValue)*100).toFixed(2):'0.00' }}%促销品采购额)</span><span v-else>(促销品采购额)</span></div>
  97. <div v-if="record.giveRuleType==='RATIO' &&record.giveRuleList && record.giveRuleList.length>0 ">
  98. <span>按比例;</span>
  99. <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
  100. {{ record.giveRuleList.length>1?item.scopeLevel+'、' :'' }}产品购买满{{ item.regularUnit==='YUAN'?toThousands(item.regularValue):item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送正价产品总金额的{{ item.promotionValue.toFixed(2) }}%为促销品采购额
  101. </div>
  102. </div>
  103. <div v-if="record.borrowTimeLimtType">产品累计:{{ record.borrowTimeLimtTypeDictValue }}{{ record.borrowedShowFlag==='1'?',':'' }}<span v-if="record.borrowedShowFlag==='1'">加盟商显示“转促”标签;</span></div>
  104. </div>
  105. <span v-else>--</span>
  106. </div>
  107. <div v-else-if="record.promotionRuleType == 'PROMO_PROD'">
  108. <div v-if="record.stackFlag==='1' && record.discountType !='0'">规则叠加;</div>
  109. <span v-if="record.discountType ==='0'">手动输入特价</span>
  110. <div v-else-if="record.discountType ==='1'" v-html="record.ruleInfo"></div>
  111. <span v-else>各级别价直降;省级直降{{ toThousands(record.provinceValue) }},市级直降{{ toThousands(record.cityValue) }},特约直降{{ toThousands(record.specialValue) }}</span>
  112. <div v-if="record.borrowTimeLimtType">产品累计:{{ record.borrowTimeLimtTypeDictValue }}{{ record.borrowedShowFlag==='1'?',':'' }}<span v-if="record.borrowedShowFlag==='1'">加盟商显示“转促”标签;</span></div>
  113. </div>
  114. <div v-else>--</div> -->
  115. </template>
  116. <!-- 操作 -->
  117. <template slot="action" slot-scope="text, record">
  118. <a-button
  119. v-if="$hasPermissions('B_rulesAddEdit')&&$route.query.type=='rule'"
  120. size="small"
  121. type="link"
  122. @click="handleEdit(record)"
  123. class="button-info"
  124. :id="'promotionDetail-edit-btn-'+record.id">编辑</a-button>
  125. <a-button
  126. v-if="$hasPermissions('B_rulesDel')&&$route.query.type=='rule'"
  127. size="small"
  128. type="link"
  129. @click="handleDel(record)"
  130. class="button-error"
  131. :id="'promotionDetail-del-btn-'+record.id">删除</a-button>
  132. <a-button
  133. v-if="$hasPermissions('B_dealerPromotionDetail')&&!$route.query.type"
  134. size="small"
  135. type="link"
  136. @click="handleDetail(record)"
  137. class="button-info"
  138. :id="'promotionDetail-info-btn-'+record.id">详情</a-button>
  139. </template>
  140. </s-table>
  141. </a-card>
  142. </a-spin>
  143. <div class="affix-cont" v-if="$route.query.type=='rule'">
  144. <a-button
  145. type="primary"
  146. class="button-info"
  147. id="promotionDetail-submit"
  148. size="large"
  149. style="padding:0 40px;"
  150. @click="handleSubmit"
  151. :disabled="disabled"
  152. v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
  153. </div>
  154. <!-- 查看参与客户 -->
  155. <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
  156. <!-- 促销品费用归属品牌/促销品费用归属品类 -->
  157. <brandCategoryModal :openType="openType" :openModal="openModal" @close="openModal = false"></brandCategoryModal>
  158. <!-- 详情 -->
  159. <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
  160. <!-- 买产品送产品 弹窗 -->
  161. <sendProductsModal :openModal="openSendProductsModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendProductsModal = false"></sendProductsModal>
  162. <!-- 买产品送采购额 弹窗 -->
  163. <sendAmountModal :openModal="openSendAmountModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendAmountModal = false"></sendAmountModal>
  164. <!-- 特价产品 弹窗 -->
  165. <specialOfferModal :openModal="openSpecialOfferModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSpecialOfferModal = false"></specialOfferModal>
  166. </div>
  167. </template>
  168. <script>
  169. import { commonMixin } from '@/utils/mixin'
  170. // 组件
  171. import { STable } from '@/components'
  172. import lookUpCustomersModal from '../promotionManagement/lookUpCustomersModal'
  173. import brandCategoryModal from './brandCategoryModal'
  174. import detailModal from './detailModal'
  175. import sendProductsModal from './sendProductsModal'
  176. import sendAmountModal from './sendAmountModal'
  177. import specialOfferModal from './specialOfferModal'
  178. // 接口
  179. import { getRuleQueryList, dealerPromotionInfo, promotionRulesDel, promotionSubmit } from '@/api/promotion'
  180. export default {
  181. name: 'DealerPromotionsDetail',
  182. mixins: [commonMixin],
  183. components: { STable, lookUpCustomersModal, brandCategoryModal, detailModal, sendProductsModal, sendAmountModal, specialOfferModal },
  184. data () {
  185. return {
  186. spinning: false,
  187. fromRouter: null,
  188. disabled: false, // 提交按钮是否可操作
  189. detailData: null, // 详情数据
  190. countData: null, // 数量数据
  191. openModal: false, // 促销品费用归属品牌/促销品费用归属品类弹窗
  192. openType: undefined, // 打开弹窗类型
  193. isShowBisiceInfo: false, // 显示隐藏基础信息
  194. openCustomerModal: false, // 查看客户弹窗
  195. openDetailModal: false, // 详情弹窗
  196. openSendProductsModal: false, // 买产品送产品弹窗
  197. openSendAmountModal: false, // 买产品送采购额弹窗
  198. openSpecialOfferModal: false, // 特价产品弹窗
  199. // 加载数据方法 必须为 Promise 对象
  200. loadData: parameter => {
  201. this.disabled = true
  202. this.spinning = true
  203. const dataAjax = Object.assign(parameter, { promotionSn: this.$route.query.sn })
  204. // 获取列表数据 无分页
  205. return getRuleQueryList(dataAjax).then(res => {
  206. let data
  207. if (res.status == 200) {
  208. data = res.data
  209. for (var i = 0; i < data.length; i++) {
  210. data[i].no = i + 1
  211. }
  212. this.disabled = false
  213. }
  214. this.spinning = false
  215. this.mainContentList = data
  216. return data
  217. })
  218. },
  219. detailSn: null, // 当前sn
  220. mainContentList: [], // 列表数据
  221. columns: [
  222. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  223. { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  224. { title: '规则简称', dataIndex: 'description', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  225. { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '23%', align: 'center' },
  226. { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '33%', align: 'left' },
  227. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  228. ]
  229. }
  230. },
  231. methods: {
  232. // 打开详情弹窗
  233. handleDetail (row) {
  234. this.detailSn = row.promotionRuleSn
  235. this.openDetailModal = true
  236. },
  237. // 关闭详情弹窗
  238. closeDetailModal () {
  239. this.detailSn = null
  240. this.openDetailModal = false
  241. },
  242. // 返回
  243. handleBack () {
  244. this.$router.push({ name: 'dealerPromotionManagement' })
  245. },
  246. // 基础信息详情
  247. getDetail () {
  248. dealerPromotionInfo({ sn: this.$route.query.sn }).then(res => {
  249. if (res.status == 200) {
  250. this.$refs.table.refresh(true)
  251. if (res.data && res.data.attachmentList) {
  252. res.data.attachmentList.forEach(item => {
  253. item.filePath = item.filePath.replace(/^http:\/\//i, 'https://')
  254. })
  255. }
  256. this.detailData = res.data || null
  257. } else {
  258. this.detailData = null
  259. }
  260. })
  261. },
  262. // 买产品送产品、买产品送采购额、特价产品 弹窗
  263. openBtnModal (str) {
  264. this.detailSn = null
  265. const name = 'open' + str + 'Modal'
  266. this[name] = true
  267. },
  268. // 查看客户
  269. handleSee () {
  270. this.openCustomerModal = true
  271. this.$nextTick(() => {
  272. this.$refs.lookUpCustomers.pageInit({ dealerSnList: this.detailData.dealerSnList ? this.detailData.dealerSnList : undefined })
  273. })
  274. },
  275. // 删除规则
  276. handleDel (row) {
  277. const _this = this
  278. this.$confirm({
  279. title: '提示',
  280. content: '确认要该规则吗?',
  281. centered: true,
  282. onOk () {
  283. _this.spinning = true
  284. promotionRulesDel({ promotionSn: _this.$route.query.sn, promotionRuleSn: row.promotionRuleSn }).then(res => {
  285. if (res.status == 200) {
  286. _this.$message.success(res.message)
  287. _this.$refs.table.refresh()
  288. _this.spinning = false
  289. } else {
  290. _this.spinning = false
  291. }
  292. })
  293. }
  294. })
  295. },
  296. // 提交
  297. handleSubmit () {
  298. const _this = this
  299. _this.disabled = true
  300. promotionSubmit({ sn: _this.$route.query.sn }).then(res => {
  301. if (res.status == 200) {
  302. _this.$message.success(res.message)
  303. _this.handleBack()
  304. }
  305. _this.disabled = false
  306. })
  307. },
  308. // 编辑
  309. handleEdit (row) {
  310. this.detailSn = row.promotionRuleSn
  311. if (row.promotionRuleType === 'BUY_PROD_GIVE_PROD') {
  312. this.openSendProductsModal = true
  313. } else if (row.promotionRuleType === 'BUY_PROD_GIVE_MONEY') {
  314. this.openSendAmountModal = true
  315. } else {
  316. this.openSpecialOfferModal = true
  317. }
  318. }
  319. },
  320. mounted () {
  321. if (!this.$store.state.app.isNewTab || this.outBizSubSn || this.bizSn) { // 页签刷新 或 为弹框时调用
  322. this.getDetail()
  323. }
  324. },
  325. activated () {
  326. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  327. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  328. this.getDetail()
  329. }
  330. },
  331. beforeRouteEnter (to, from, next) {
  332. next(vm => {
  333. vm.fromRouter = from
  334. })
  335. }
  336. }
  337. </script>
  338. <style lang="less" scoped>
  339. .promotionDetail-wrap{
  340. position: relative;
  341. height: 100%;
  342. padding-bottom: 71px;
  343. box-sizing: border-box;
  344. transform: translateZ(0);
  345. .promotionDetail-cont{
  346. margin-bottom: 6px;
  347. }
  348. .btnGroup{
  349. margin-bottom:15px;
  350. }
  351. .flex{
  352. display:flex;
  353. align-items: center;
  354. }
  355. .footer-cont{
  356. margin-top: 5px;
  357. text-align: center;
  358. }
  359. .attachmentBox>a::after{
  360. content:','
  361. }
  362. .attachmentBox>a:last-child::after{
  363. content:''
  364. }
  365. /deep/.ant-descriptions-item-label .ant-descriptions-item-colon{
  366. display:inline-block !important;
  367. vertical-align: top;
  368. max-width:10%;
  369. }
  370. /deep/.ant-descriptions-item-content{
  371. display:inline-block !important;
  372. max-width:89%;
  373. vertical-align: top;
  374. }
  375. .footerBtn{
  376. width: 100%;
  377. text-align:center;
  378. position:fixed;
  379. bottom:0;
  380. right:0px;
  381. box-shadow: 0 0 20px #dcdee2;
  382. }
  383. }
  384. </style>