detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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-info" @click="openBtnModal('SendProducts')" :disabled="disabled">买产品送产品</a-button>
  44. <a-button type="primary" class="button-info" @click="openBtnModal('SendAmount')" :disabled="disabled">买产品送采购额</a-button>
  45. <a-button type="primary" style="margin-left:5px;" @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. class="button-info"
  115. size="large"
  116. style="padding:0 40px;"
  117. @click="handleSubmit"
  118. :disabled="disabled"
  119. v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
  120. </a-card>
  121. </div>
  122. </a-spin>
  123. <!-- 查看参与客户 -->
  124. <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
  125. <!-- 促销品费用归属品牌/促销品费用归属品类 -->
  126. <brandCategoryModal :openType="openType" :openModal="openModal" @close="openModal = false"></brandCategoryModal>
  127. <!-- 详情 -->
  128. <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
  129. <!-- 买产品送产品 弹窗 -->
  130. <sendProductsModal :openModal="openSendProductsModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendProductsModal = false"></sendProductsModal>
  131. <!-- 买产品送采购额 弹窗 -->
  132. <sendAmountModal :openModal="openSendAmountModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSendAmountModal = false"></sendAmountModal>
  133. <!-- 特价产品 弹窗 -->
  134. <specialOfferModal :openModal="openSpecialOfferModal" :itemSn="detailSn" :promotionSn="$route.query.sn" @ok="$refs.table.refresh()" @close="openSpecialOfferModal = false"></specialOfferModal>
  135. </div>
  136. </template>
  137. <script>
  138. import { commonMixin } from '@/utils/mixin'
  139. import { STable } from '@/components'
  140. import lookUpCustomersModal from '../promotionManagement/lookUpCustomersModal'
  141. import brandCategoryModal from './brandCategoryModal'
  142. import detailModal from './detailModal'
  143. import sendProductsModal from './sendProductsModal'
  144. import sendAmountModal from './sendAmountModal'
  145. import specialOfferModal from './specialOfferModal'
  146. import { getRuleQueryList, dealerPromotionInfo, promotionRulesDel, promotionSubmit } from '@/api/promotion'
  147. export default {
  148. name: 'SalesOrderWarehouseDetail',
  149. mixins: [commonMixin],
  150. components: { STable, lookUpCustomersModal, brandCategoryModal, detailModal, sendProductsModal, sendAmountModal, specialOfferModal },
  151. data () {
  152. return {
  153. disabled: false,
  154. spinning: false,
  155. detailData: null, // 详情数据
  156. countData: null, // 数量数据
  157. fromRouter: null,
  158. openModal: false,
  159. isShowBisiceInfo: false,
  160. openCustomerModal: false,
  161. openType: undefined,
  162. openDetailModal: false,
  163. openSendProductsModal: false,
  164. openSendAmountModal: false,
  165. openSpecialOfferModal: false,
  166. // 加载数据方法 必须为 Promise 对象
  167. loadData: parameter => {
  168. this.disabled = true
  169. this.spinning = true
  170. const dataAjax = Object.assign(parameter, { promotionSn: this.$route.query.sn })
  171. return getRuleQueryList(dataAjax).then(res => {
  172. let data
  173. if (res.status == 200) {
  174. data = res.data
  175. for (var i = 0; i < data.length; i++) {
  176. data[i].no = i + 1
  177. }
  178. this.disabled = false
  179. }
  180. this.spinning = false
  181. this.mainContentList = data
  182. return data
  183. })
  184. },
  185. detailSn: null,
  186. mainContentList: []
  187. }
  188. },
  189. computed: {
  190. columns () {
  191. const _this = this
  192. const arr = [
  193. { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
  194. { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  195. { title: '规则简称', dataIndex: 'description', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  196. { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '20%', align: 'center' },
  197. { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '20%', align: 'center' },
  198. { title: '订单起订金额(元)', dataIndex: 'minOrderAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  199. { title: '活动经费上限(元)', dataIndex: 'upperLimitAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  200. { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
  201. ]
  202. return arr
  203. }
  204. },
  205. methods: {
  206. // 打开详情弹窗
  207. handleDetail (row) {
  208. this.detailSn = row.promotionRuleSn
  209. this.openDetailModal = true
  210. },
  211. // 关闭详情弹窗
  212. closeDetailModal () {
  213. this.detailSn = null
  214. this.openDetailModal = false
  215. },
  216. // 返回
  217. handleBack () {
  218. this.$router.push({ name: 'dealerPromotionManagement' })
  219. },
  220. // 基础信息详情
  221. getDetail () {
  222. dealerPromotionInfo({ sn: this.$route.query.sn }).then(res => {
  223. if (res.status == 200) {
  224. this.$refs.table.refresh(true)
  225. if (res.data && res.data.attachmentList) {
  226. res.data.attachmentList.forEach(item => {
  227. item.filePath = item.filePath.replace(/^http:\/\//i, 'https://')
  228. })
  229. }
  230. this.detailData = res.data || null
  231. } else {
  232. this.detailData = null
  233. }
  234. })
  235. },
  236. // 买产品送产品、买产品送采购额、特价产品 弹窗
  237. openBtnModal (str) {
  238. this.detailSn = null
  239. const name = 'open' + str + 'Modal'
  240. this[name] = true
  241. },
  242. // 查看客户
  243. handleSee () {
  244. this.openCustomerModal = true
  245. this.$nextTick(() => {
  246. this.$refs.lookUpCustomers.pageInit({ dealerSnList: this.detailData.dealerSnList ? this.detailData.dealerSnList : undefined })
  247. })
  248. },
  249. // 删除规则
  250. handleDel (row) {
  251. const _this = this
  252. this.$confirm({
  253. title: '提示',
  254. content: '确认要该规则吗?',
  255. centered: true,
  256. onOk () {
  257. _this.spinning = true
  258. promotionRulesDel({ promotionSn: _this.$route.query.sn, promotionRuleSn: row.promotionRuleSn }).then(res => {
  259. if (res.status == 200) {
  260. _this.$message.success(res.message)
  261. _this.$refs.table.refresh()
  262. _this.spinning = false
  263. } else {
  264. _this.spinning = false
  265. }
  266. })
  267. }
  268. })
  269. },
  270. // 提交
  271. handleSubmit () {
  272. const _this = this
  273. _this.disabled = true
  274. promotionSubmit({ sn: _this.$route.query.sn }).then(res => {
  275. if (res.status == 200) {
  276. _this.$message.success(res.message)
  277. _this.handleBack()
  278. }
  279. _this.disabled = false
  280. })
  281. },
  282. handleEdit (row) {
  283. this.detailSn = row.promotionRuleSn
  284. if (row.promotionRuleType === 'BUY_PROD_GIVE_PROD') {
  285. this.openSendProductsModal = true
  286. } else if (row.promotionRuleType === 'BUY_PROD_GIVE_MONEY') {
  287. this.openSendAmountModal = true
  288. } else {
  289. this.openSpecialOfferModal = true
  290. }
  291. }
  292. },
  293. mounted () {
  294. if (!this.$store.state.app.isNewTab || this.outBizSubSn || this.bizSn) { // 页签刷新 或 为弹框时调用
  295. this.getDetail()
  296. }
  297. },
  298. activated () {
  299. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  300. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  301. this.getDetail()
  302. }
  303. },
  304. beforeRouteEnter (to, from, next) {
  305. next(vm => {
  306. vm.fromRouter = from
  307. })
  308. }
  309. }
  310. </script>
  311. <style lang="less" scoped>
  312. .salesDetail-wrap{
  313. position: relative;
  314. height: 100%;
  315. padding-bottom: 71px;
  316. box-sizing: border-box;
  317. transform: translateZ(0);
  318. .salesDetail-cont{
  319. margin-bottom: 6px;
  320. }
  321. .btnGroup{
  322. margin-bottom:15px;
  323. }
  324. .flex{
  325. display:flex;
  326. align-items: center;
  327. }
  328. .footer-cont{
  329. margin-top: 5px;
  330. text-align: center;
  331. }
  332. .attachmentBox>a::after{
  333. content:','
  334. }
  335. .attachmentBox>a:last-child::after{
  336. content:''
  337. }
  338. /deep/.ant-descriptions-item-label .ant-descriptions-item-colon{
  339. display:inline-block !important;
  340. vertical-align: top;
  341. max-width:10%;
  342. }
  343. /deep/.ant-descriptions-item-content{
  344. display:inline-block !important;
  345. max-width:89%;
  346. vertical-align: top;
  347. }
  348. .footerBtn{
  349. width: 100%;
  350. text-align:center;
  351. position:fixed;
  352. bottom:0;
  353. right:0px;
  354. box-shadow: 0 0 20px #dcdee2;
  355. }
  356. }
  357. </style>