edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <div class="salesNewEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.salesBillNo }}</span>
  9. <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
  10. <a-button type="link" class="button-default" @click="showDetail=!showDetail">
  11. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  12. </a-button>
  13. </template>
  14. </a-page-header>
  15. <!-- 单据详情 -->
  16. <a-card size="small" :bordered="false" class="salesEdit-cont" v-show="showDetail">
  17. <div style="padding: 10px;">
  18. <a-descriptions size="small" :column="3">
  19. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="收货地址" :span="2">{{ shippingAddress||'--' }}</a-descriptions-item>
  21. <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
  28. </a-descriptions>
  29. </div>
  30. </a-card>
  31. <!-- 正常产品 -->
  32. <a-card size="small" :bordered="false" class="salesEdit-cont" v-if="salesBillSn">
  33. <div style="padding: 10px;">
  34. <productNormalList
  35. ref="productNormalList"
  36. @insterOk="insterActiveOk"
  37. @openCpModal="openProductModal"
  38. :showTotal="showTotal"
  39. :detailData="detailData"
  40. :warehouseSn="warehouseSn"
  41. :salesBillSn="salesBillSn"></productNormalList>
  42. </div>
  43. </a-card>
  44. <!-- 活动产品 -->
  45. <a-card
  46. size="small"
  47. :bordered="false"
  48. class="salesEdit-cont"
  49. v-for="item in activeList"
  50. :key="item.promoRuleSn"
  51. v-if="activeList.length"
  52. >
  53. <div slot="title" style="display: inline-block;width:100%;">
  54. <strong style="margin-right:10px;font-size:14px;">{{item.promotion.description}}</strong> ({{item.promotionRule.description}})
  55. <span style="margin-left:20px;color:#00aaff;cursor: pointer;" @click="(event) => {showDesc(event, item)}">
  56. <a-icon :type="item.showDesc ? 'eye-invisible' : 'eye'"/> 活动详情
  57. </span>
  58. <span :style="{margin:'0 20px',color:item.disabled?'#14b900':'#ff0800',cursor: 'pointer'}" @click="(event) => {disenablePromp(event, item)}">
  59. <a-icon title="禁用规则" :type="item.disabled?'link':'disconnect'"/> {{item.disabled ? '启用规则' : '禁用规则'}}
  60. </span>
  61. </div>
  62. <div slot="extra" @click="tooglePanel(item)" style="cursor: pointer;">{{ item.isActive ? '收起' : '展开' }} <a-icon type="caret-right" :rotate="item.isActive ? 90 : 0"/> </div>
  63. <div v-show="item.isActive" style="padding: 10px;">
  64. <productList
  65. :ref="'productList-'+item.promoRuleSn"
  66. :id="item.promoRuleSn"
  67. @openCpModal="openProductModal"
  68. @insterOk="insterActiveOk"
  69. @showDesc="v => showDescOk(v,item)"
  70. @upActive="upActive"
  71. :promo="item"
  72. :detailData="detailData"
  73. :warehouseSn="warehouseSn"
  74. :salesBillSn="salesBillSn"></productList>
  75. </div>
  76. </a-card>
  77. </a-spin>
  78. <div class="affix-cont">
  79. <div class="footer-price">
  80. <div></div>
  81. <div v-if="detailData">
  82. <div class="totalPrice">总售价:¥<span>{{ toThousands(detailData.totalAmount) }}</span></div>
  83. <div>
  84. 产品总款数:<strong style="margin-right: 10px;"> {{ detailData.totalCategory }} </strong>
  85. 总数量:<strong> {{ detailData.totalQty }} </strong>
  86. <span style="margin:0 10px;" v-if="detailData.totalDiscountAmount">优惠金额:¥-<strong>{{ Number(detailData.totalDiscountAmount).toFixed(2) }}</strong></span>
  87. <a-popover title="优惠明细" @visibleChange="(visible)=>{visible&&getPromYhDetail()}">
  88. <a-button shape="round" size="small" v-if="detailData.totalDiscountAmount">优惠明细</a-button>
  89. <div slot="content">
  90. <div v-if="yhDetail">
  91. <div
  92. class="yhdetail"
  93. style="min-width:300px;margin-bottom: 5px;"
  94. v-for="(item,index) in yhDetail.promoMapList"
  95. :key="index">
  96. <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">{{ item.description }}</div>
  97. <div style="padding-left:10px;"
  98. v-for="(sitem,sindex) in item.promoRuleMapList"
  99. :key="sindex"
  100. v-if="sitem.lossAmount"
  101. >
  102. <div style="display: flex;justify-content: space-between;">
  103. <span>{{sitem.promotionRuleTypeDictValue}}:</span>
  104. <strong>¥{{ toThousands(sitem.lossAmount) }}</strong>
  105. </div>
  106. <div class="yhdetail-d" style="color:#999;">{{ sitem.description }}</div>
  107. </div>
  108. </div>
  109. <div class="yhdetail" style="display: flex;justify-content: space-between;">
  110. <span style="font-weight: bold;font-size:14px;">优惠金额:</span>
  111. <span style="font-weight: bold;font-size:18px;">¥{{ Number(yhDetail.totalLossAmount).toFixed(2) }}</span>
  112. </div>
  113. </div>
  114. <div style="text-align: center;padding: 20px;" v-else>
  115. 正在加载...
  116. </div>
  117. </div>
  118. </a-popover>
  119. </div>
  120. </div>
  121. </div>
  122. <div>
  123. <a-button
  124. size="large"
  125. style="padding: 0 60px;"
  126. :disabled="spinning"
  127. type="primary"
  128. class="button-primary"
  129. @click="handleSubmit()"
  130. id="productInfoList-handleSubmit">提交</a-button>
  131. </div>
  132. </div>
  133. <!-- 添加产品 -->
  134. <chooseProduct
  135. ref="chooseProduct"
  136. :openModal="showCpModal"
  137. @close="closeProductModal"
  138. @addProduct="insterProduct"></chooseProduct>
  139. <!-- 价格更新弹窗 -->
  140. <setPriceModal
  141. :show="priceUpdateModal"
  142. :totalRealAmount="updataData.totalRealAmount"
  143. :totalAmount="updataData.totalAmount"
  144. @ok="updatePrice"
  145. @cancel="priceUpdateModal=false"></setPriceModal>
  146. <!-- 新活动窗口 -->
  147. <newPromoModal
  148. :show="showNewActiveModal"
  149. :salesBillSn="salesBillSn"
  150. :newActiveList="newActiveList"
  151. @ok="showNewActiveOk"
  152. ></newPromoModal>
  153. </div>
  154. </template>
  155. <script>
  156. import { commonMixin } from '@/utils/mixin'
  157. import productList from './comps/productList.vue'
  158. import productNormalList from './comps/productNormalList.vue'
  159. import chooseProduct from './comps/chooseProduct.vue'
  160. import setPriceModal from './setPriceModal.vue'
  161. import newPromoModal from './newPromoModal.vue'
  162. import { salesDisablePromo,salesEnablePromoPromo, salesChangePromo } from '@/api/salesDetailNew'
  163. import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo,salesPromoValidaSubmit } from '@/api/salesNew'
  164. export default {
  165. name: 'SalesNewEdit',
  166. mixins: [commonMixin],
  167. components:{
  168. setPriceModal,
  169. productList,
  170. chooseProduct,
  171. productNormalList,
  172. newPromoModal
  173. },
  174. data () {
  175. return {
  176. spinning: false,
  177. activeList:[], // 活动列表
  178. newActiveList: [], // 新活动列表
  179. activeDesKey: {},
  180. salesBillSn: null, // 销售单sn
  181. detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
  182. warehouseSn: undefined,
  183. updataData: {
  184. totalRealAmount: '',
  185. totalAmount: ''
  186. },
  187. priceUpdateModal: false, // 价格更新弹窗
  188. showDetail: false,
  189. showCpModal: false,
  190. cpCurRefId: '',
  191. disabledActiveOption: null,
  192. yhDetail: null,
  193. showNewActiveModal: false
  194. }
  195. },
  196. computed: {
  197. showTotal(){
  198. return this.activeList.length > 0
  199. },
  200. shippingAddress () {
  201. const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
  202. const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
  203. const shippingAddrCountyName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCountyName ? this.detailData.salesBillExtEntity.shippingAddrCountyName : ''
  204. const shippingAddr = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddr ? this.detailData.salesBillExtEntity.shippingAddr : ''
  205. if (!shippingAddrProvinceName && !shippingAddrCityName && !shippingAddrCountyName && !shippingAddr) {
  206. return '--'
  207. } else {
  208. return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
  209. }
  210. }
  211. },
  212. methods: {
  213. // 返回
  214. handleBack () {
  215. this.$router.push({ name: 'salesQueryNewList', query: { closeLastOldTab: true } })
  216. },
  217. tooglePanel(item){
  218. item.isActive=!item.isActive
  219. this.activeList.splice()
  220. // 刷新当前表格
  221. if(item.isActive){
  222. const row = this.$refs['productList-'+item.promoRuleSn][0]
  223. row&&row.resetSearchForm()
  224. }
  225. },
  226. // 销售单详情
  227. getOrderDetail (flag) {
  228. salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
  229. if (res.status == 200) {
  230. this.detailData = res.data
  231. this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount||0) - Number(this.detailData.totalAmount||0)
  232. }
  233. if(flag){
  234. this.getActiveList()
  235. }
  236. })
  237. },
  238. // 优惠明细查看
  239. getPromYhDetail(){
  240. salesPromoQueryCount({salesBillSn: this.$route.params.sn }).then(res => {
  241. if (res.status == 200) {
  242. this.yhDetail = res.data
  243. }
  244. })
  245. },
  246. // 判断是否全部调用完
  247. isAllLoadFinish(mlist){
  248. const nid = setInterval(()=>{
  249. const ret = []
  250. mlist.map(item => {
  251. const da = item.disabled
  252. ret.push(da)
  253. })
  254. // 加载完了
  255. if(!ret.includes(true)){
  256. clearInterval(nid)
  257. this.spinning = false
  258. }
  259. console.log(ret)
  260. }, 50)
  261. },
  262. // 刷新所有表格数据
  263. updateAllTable(flag){
  264. const activeList = this.activeList.filter(item=>item.isActive)
  265. const mlist = []
  266. this.spinning = true
  267. // 加载正常产品列表
  268. this.$refs.productNormalList.resetSearchForm()
  269. mlist.push(this.$refs.productNormalList)
  270. // 刷新所有活动产品列表
  271. activeList.map(item => {
  272. const row = this.$refs['productList-' + item.promoRuleSn][0]
  273. row&&row.resetSearchForm()
  274. mlist.push(row)
  275. })
  276. // 判断是否全部调用完
  277. this.isAllLoadFinish(mlist)
  278. // 是否刷新详情
  279. if(flag){
  280. this.getOrderDetail()
  281. }
  282. },
  283. // 获取销售单参与的活动列表
  284. async getActiveList(){
  285. // 已参与活动列表
  286. this.activeList = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
  287. this.activeList.map(item => {
  288. item.isActive = item.enabledFlag == 1
  289. item.showDesc = false
  290. item.disabled = item.enabledFlag == 0
  291. this.activeDesKey['search-'+item.promoRuleSn] = false
  292. })
  293. setTimeout(()=> {
  294. this.updateAllTable()
  295. }, 500)
  296. },
  297. // 获取是否有新活动
  298. async getNewActive(){
  299. const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn, enabledFlag: "1" }).then(res => res.data)
  300. if(hasNewActive.length){
  301. this.newActiveList = hasNewActive
  302. this.showNewActiveModal=true
  303. }
  304. },
  305. showNewActiveOk(){
  306. this.showNewActiveModal = false
  307. this.getOrderDetail(true)
  308. },
  309. // 添加产品,包括正常和活动的产品
  310. closeProductModal(type){
  311. this.cpCurRefId = ''
  312. this.showCpModal = false
  313. // 刷新表格
  314. this.insterActiveOk(['normal','promo'][type])
  315. },
  316. // 打开选择产品弹框
  317. openProductModal(type, refId){
  318. console.log(type, refId)
  319. const promo = this.activeList.find(item => item.promoRuleSn == refId)
  320. this.$refs.chooseProduct.pageInit(this.detailData, promo, type)
  321. this.cpCurRefId = 'productList-' + refId
  322. this.showCpModal = true
  323. },
  324. // 添加活动产品成功的回调
  325. insterActiveOk(type){
  326. console.log(type)
  327. const mlist = []
  328. this.spinning = true
  329. if(type == 'promo'){
  330. // 刷新正常产品列表
  331. this.$refs.productNormalList.resetSearchForm()
  332. mlist.push(this.$refs.productNormalList)
  333. }
  334. if(type == 'normal'){
  335. // 刷新活动产品列表
  336. const activeList = this.activeList.filter(item=>item.isActive)
  337. activeList.map(item => {
  338. const row = this.$refs['productList-' + item.promoRuleSn][0]
  339. row&&row.resetSearchForm()
  340. mlist.push(row)
  341. })
  342. }
  343. // 判断是否全部调用完
  344. this.isAllLoadFinish(mlist)
  345. this.getOrderDetail()
  346. },
  347. // 新增产品
  348. insterProduct(row, promotionFlag, type){
  349. // 正常产品
  350. if(type == 0){
  351. this.$refs.productNormalList.insterProduct(row, promotionFlag)
  352. }else{
  353. // 活动产品
  354. this.$refs[this.cpCurRefId][0].insterProduct(row, promotionFlag, type)
  355. }
  356. },
  357. // 更换活动
  358. upActive(oldPromo,data,params){
  359. const promo = data.split('-')
  360. const newSn = this.activeList.find(item => item.promoRuleSn == promo[1])
  361. const newSalesPromoSn = newSn && newSn.salesPromoSn || ''
  362. salesChangePromo({
  363. salesPromoSn: data != 0 ? newSalesPromoSn : '',
  364. promoRuleSn: promo[1],
  365. promotionFlag: promo[2]||'',
  366. ...params
  367. }).then(res => {
  368. if(res.status == 200){
  369. const mlist = []
  370. this.spinning = true
  371. // 刷新新参与活动
  372. if(data != 0){
  373. const nt = this.$refs['productList-'+promo[1]][0]
  374. nt&&nt.resetSearchForm()
  375. mlist.push(nt)
  376. }
  377. // 刷新正常活动
  378. const pnt = this.$refs.productNormalList
  379. pnt&&pnt.resetSearchForm()
  380. mlist.push(pnt)
  381. // 刷新当前活动
  382. const ot = this.$refs['productList-'+oldPromo.promoRuleSn][0]
  383. ot&&ot.upAcitveSuccess()
  384. mlist.push(ot)
  385. // 判断是否全部调用完
  386. this.isAllLoadFinish(mlist)
  387. // 刷新详情统计
  388. this.getOrderDetail()
  389. }
  390. })
  391. },
  392. // 选择价格类型 并更新
  393. updatePrice (type) {
  394. const _this = this
  395. if (type == 0) {
  396. const ajax_data = {
  397. salesBillSn: _this.salesBillSn,
  398. productPriceChangeFlag: type
  399. }
  400. _this.submitResult(ajax_data)
  401. } else {
  402. updateBatch(_this.updataData.detailList).then(res => {
  403. if (res.status == 200) {
  404. const ajax_data = {
  405. salesBillSn: _this.salesBillSn,
  406. productPriceChangeFlag: type
  407. }
  408. _this.submitResult(ajax_data)
  409. }
  410. })
  411. }
  412. },
  413. // 提交销售单
  414. handleSubmit () {
  415. // 先不提交,先判断是否有价格更新 (下级创建时判断)
  416. if (this.detailData && this.detailData.salesBillSource && this.detailData.salesBillSource == 'PURCHASE') {
  417. submitCheck({ salesBillSn: this.salesBillSn }).then(res => {
  418. if (res.status == 200) {
  419. if (res.data.detailList.length > 0) {
  420. this.updataData = res.data
  421. const _this = this
  422. this.$nextTick(() => {
  423. _this.priceUpdateModal = true
  424. })
  425. } else {
  426. this.submitResult({ salesBillSn: this.salesBillSn })
  427. }
  428. }
  429. })
  430. } else {
  431. this.submitResult({ salesBillSn: this.salesBillSn })
  432. }
  433. },
  434. // 提交销售单
  435. async submitResult (data) {
  436. const _this = this
  437. // 校验活动规则
  438. const vaildActive = await salesPromoValidaSubmit({salesBillSn: this.salesBillSn}).then(res => res.data)
  439. // console.log(vaildActive)
  440. const a = vaildActive.filter(item => item.type == 1) // 不可提交
  441. const b = vaildActive.filter(item => item.type == 0) // 可跳过继续提交
  442. // 弹出不符合规则弹框,不可提交
  443. if(a.length){
  444. this.$info({
  445. title: '提示',
  446. centered: true,
  447. class:'confirm-center',
  448. okText:'关闭',
  449. width: 600,
  450. content: <div style="padding-top:15px;">
  451. <ol>
  452. {a.map(item => (
  453. <li style="padding:3px 0;">{item.message}</li>
  454. ))}
  455. </ol>
  456. <div style="padding:10px 0;text-align:center"><strong>请按照以上提示修改后再提交</strong></div>
  457. </div>
  458. });
  459. }else{
  460. // 弹出确认提示信息,可跳过继续提交
  461. if(b.length){
  462. this.$confirm({
  463. title: '提示',
  464. centered: true,
  465. class:'confirm-center',
  466. okText:'提交',
  467. width: 600,
  468. content: <div style="padding-top:15px;">
  469. <ol>
  470. {b.map(item => (
  471. <li style="padding:3px 0;">{item.message}</li>
  472. ))}
  473. </ol>
  474. </div>,
  475. onOk() {
  476. _this.submitOrder(data)
  477. }
  478. });
  479. }else{
  480. _this.submitOrder(data)
  481. }
  482. }
  483. },
  484. async submitOrder(data){
  485. this.spinning = true
  486. const res = await salesWriteSubmit(data)
  487. if (res.status == 200) {
  488. this.handleBack()
  489. this.$message.success(res.message)
  490. }
  491. this.spinning = false
  492. },
  493. // 展开收缩活动详情
  494. showDesc(e,item){
  495. e.stopPropagation()
  496. item.isActive = true
  497. const row = this.$refs['productList-'+item.promoRuleSn][0]
  498. row&&row.showDesc(item.promotionRule)
  499. },
  500. showDescOk(v,item){
  501. item.showDesc = v
  502. this.activeList.splice()
  503. },
  504. // 启用规则
  505. enabledActive(e,item){
  506. const _this = this
  507. this.spinning = true
  508. salesEnablePromoPromo({
  509. salesBillSn: _this.salesBillSn,
  510. salesPromoSn: item.salesPromoSn
  511. }).then(res => {
  512. if(res.status == 200){
  513. item.disabled = false
  514. item.isActive = true
  515. _this.activeList.splice()
  516. // 禁用按钮
  517. _this.$refs['productList-'+item.promoRuleSn][0].disableActive(false)
  518. // 刷新所有表格
  519. _this.updateAllTable(true)
  520. _this.spinning = false
  521. _this.$message.success("操作成功,请添加产品")
  522. }
  523. })
  524. },
  525. // 禁用规则
  526. disabledActive(e,item){
  527. const _this = this
  528. _this.spinning = true
  529. salesDisablePromo({
  530. salesBillSn: _this.salesBillSn,
  531. salesPromoSn: item.salesPromoSn,
  532. promoRuleSn: item.promoRuleSn,
  533. salesDisableType: _this.disabledActiveOption
  534. }).then(res => {
  535. if(res.status == 200){
  536. item.disabled = true
  537. item.isActive = false
  538. _this.activeList.splice()
  539. // 启用按钮
  540. _this.$refs['productList-'+item.promoRuleSn][0].disableActive(true)
  541. // 刷新所有表格
  542. _this.updateAllTable(true)
  543. _this.disabledActiveOption = null
  544. _this.spinning = false
  545. _this.$message.success("操作成功")
  546. }
  547. })
  548. },
  549. // 禁用启用活动规则
  550. disenablePromp(e,item){
  551. const _this = this
  552. const table = _this.$refs['productList-'+item.promoRuleSn][0]
  553. // 是否启用规则
  554. if(item.disabled){
  555. this.enabledActive(e,item)
  556. return
  557. }
  558. // 如果没有活动产品,直接禁用无需弹框提示
  559. if(table.countData&&!table.countData.totalQty){
  560. _this.disabledActiveOption = 'DELETE'
  561. _this.disabledActive(e,item)
  562. return
  563. }
  564. // 弹框提示禁用方式
  565. this.$confirm({
  566. title: '确定禁用规则?',
  567. centered: true,
  568. class:'confirm-center',
  569. content: <div>
  570. <div style="padding:10px 0;text-align:center;">禁用规则后,将无法享受该活动规则优惠</div>
  571. <div style="padding:0 0 10px 0;text-align:center;">
  572. <aRadioGroup onChange={_this.changeDaOpt}>
  573. <aRadio style="display:block;height: '30px';lineHeight: '30px';padding:5px 0;" value="DELETE">
  574. 删除规则中相关产品
  575. </aRadio>
  576. <aRadio style="display:block;height: '30px';lineHeight: '30px';padding:5px 0;" value="REMOVE">
  577. 移出规则中相关产品
  578. </aRadio>
  579. </aRadioGroup>
  580. </div>
  581. </div>,
  582. onOk() {
  583. if(_this.disabledActiveOption){
  584. _this.disabledActive(e,item)
  585. }else{
  586. _this.$message.info("请选择禁用方式!")
  587. return true
  588. }
  589. },
  590. onCancel() {
  591. _this.disabledActiveOption = null
  592. },
  593. });
  594. },
  595. changeDaOpt(e){
  596. this.disabledActiveOption = e.target.value
  597. },
  598. pageInit () {
  599. this.salesBillSn = this.$route.params.sn
  600. this.warehouseSn = this.$route.params.sn ? this.$route.params.wSn : ''
  601. this.getOrderDetail(true)
  602. this.getNewActive()
  603. }
  604. },
  605. mounted () {
  606. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  607. this.pageInit()
  608. }
  609. },
  610. activated () {
  611. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  612. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  613. this.pageInit()
  614. }
  615. },
  616. beforeRouteEnter (to, from, next) {
  617. next(vm => {})
  618. }
  619. }
  620. </script>
  621. <style lang="less">
  622. .salesNewEdit-wrap{
  623. position: relative;
  624. height: 100%;
  625. padding-bottom: 75px;
  626. box-sizing: border-box;
  627. >.ant-spin-nested-loading{
  628. overflow-y: auto;
  629. height: 100%;
  630. }
  631. .salesEdit-cont{
  632. margin: 10px 0;
  633. }
  634. .redStyle{
  635. font-weight: bold;
  636. color: red;
  637. }
  638. .ellipsisCon{
  639. display: flex;
  640. justify-content: space-between;
  641. align-items: center;
  642. .ellipsisText{
  643. width: 100%;
  644. overflow: hidden;
  645. text-overflow: ellipsis;
  646. display: box;
  647. display: -webkit-box;
  648. -webkit-line-clamp: 1;
  649. -webkit-box-orient: vertical;
  650. }
  651. }
  652. .ant-card-small > .ant-card-body {
  653. padding: 0!important;
  654. }
  655. .affix-cont{
  656. padding: 10px 15px;
  657. text-align: right;
  658. display: flex;
  659. justify-content: space-between;
  660. align-items: center;
  661. .footer-price{
  662. flex-grow:1;
  663. display: flex;
  664. justify-content: flex-end;
  665. align-items: center;
  666. > div{
  667. padding: 0 15px;
  668. }
  669. .totalPrice{
  670. span{
  671. font-weight: bold;
  672. color: red;
  673. font-size: 20px;
  674. }
  675. }
  676. }
  677. }
  678. }
  679. </style>