detail.vue 17 KB

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