detail.vue 15 KB

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