edit.vue 25 KB

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