order-details.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <view class="container details clearfix" :style="{paddingBottom :isIphoneX ? (130+68)+'rpx' : '130rpx'}">
  3. <!-- 自定义返回 -->
  4. <header-back :systeminfo='systeminfo' :navbar-data='nvabarData' :headerBtnPosi ="headerBtnPosi" :isShare='isOrderShare'></header-back>
  5. <view class="container-details" :style="{paddingTop:navbarHeight+'px'}">
  6. <view class="status-text">
  7. <view class="view-type">{{ information.status | TextFormat }}</view>
  8. <view class="Rebate " v-if="information.rebateFlag==1">返佣</view>
  9. <text class="bage-buss btn" v-if="information.orderSubmitType == 3 || information.orderSubmitType == 4">协销</text>
  10. <text class="bage-auto btn" v-if="information.orderSubmitType == 0 || information.orderSubmitType == 1 ||information.orderSubmitType == 2">自主</text>
  11. </view>
  12. <!-- 地址选择 -->
  13. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  14. <!-- 商品 -->
  15. <goods-list ref='goods' v-if="isRequest" :shopOrderData="shopOrderData" @popupClick="hanldePopupFn"></goods-list>
  16. <!-- 订单信息 -->
  17. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  18. <!-- 发票信息 -->
  19. <invoice-tent ref="invoice" v-if="isRequest" :orderInvoice="orderInvoice"></invoice-tent>
  20. <!-- 转账信息 -->
  21. <!-- <transfe-record ref="transfe" v-if="isRequest"></transfe-record> -->
  22. <!-- 支付记录 -->
  23. <payment-record ref="payment" v-if="isRequest" :discernReceiptList="discernReceiptList" :receiptAmount="receiptAmount"></payment-record>
  24. <!-- 退款记录 -->
  25. <refund-record ref="refund" v-if="isRequest" :returnedPurchaseList="returnedPurchaseList" :returnedPurchaseFee="returnedPurchaseFee"></refund-record>
  26. <view class="clause" @tap.stop="openclauseConten(clauseData.id)" :class="clauseData.name=='无条款'?'noclick':''">
  27. 售后条款:<label class="text" :class="clauseData.name=='无条款'?'color-bg':''">{{clauseData.name}}</label>
  28. </view>
  29. <!-- 底部button -->
  30. <order-button ref="orderButton"
  31. v-if= "isRequest"
  32. :status= "btnStatus"
  33. :order="information"
  34. :rechargeGoods = "rechargeGoods"
  35. :ableUserMoney = "ableUserMoney"
  36. :shareCode= "shareCode"
  37. @buttonConfirm="handButtonConfirm">
  38. </order-button>
  39. </view>
  40. <!-- 付款弹窗 -->
  41. <order-model v-if="isPayModel"
  42. :payModelData="payModelData"
  43. :modelType='modelType'
  44. @paymentConfirm ='hanldPaymentConfirm'/>
  45. <!-- 分享弹窗 -->
  46. <share-alert :orderID="orderID"
  47. v-if="isShareModal"
  48. @shareConfirm ='onShareAppMessage'>
  49. </share-alert>
  50. <!-- 促销活动弹窗 -->
  51. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  52. </view>
  53. </template>
  54. <script>
  55. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  56. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  57. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  58. import invoiceTent from '@/components/cm-module/orderDetails/invoiceTent' //发票信息
  59. import orderInformation from '@/components/cm-module/orderDetails/orderInformation' //订单信息
  60. import transfeRecord from '@/components/cm-module/orderDetails/transfeRecord' //转账信息
  61. import paymentRecord from '@/components/cm-module/orderDetails/paymentRecord' //支付记录
  62. import refundRecord from '@/components/cm-module/orderDetails/refundRecord' //退款记录
  63. import orderButton from '@/components/cm-module/orderDetails/sellerDetaileButton' //底部按钮
  64. import shareAlert from '@/components/cm-module/modelAlert/sellerShareAlert.vue' //分享弹窗
  65. import orderModel from '@/components/cm-module/modelAlert/order-alert' //付款弹窗
  66. import activiPopup from "@/components/cm-module/orderDetails/activipopu" //促销活动弹窗
  67. import { queryOrderDetails,cancelOrder,deleteOrder,affirmOrder } from "@/api/order.js"
  68. export default {
  69. components:{
  70. headerBack,
  71. orderInformation,
  72. orderAddress,
  73. invoiceTent,
  74. goodsList,
  75. transfeRecord,
  76. paymentRecord,
  77. refundRecord,
  78. orderButton,
  79. shareAlert,
  80. orderModel,
  81. activiPopup
  82. },
  83. data() {
  84. return {
  85. state:0,
  86. userID:'',
  87. orderID:'',
  88. serviceProviderId:'', //协销ID
  89. shareCode:'', //分享码
  90. shareType:'', //分享登录页过来记录的状态
  91. cellPhone:'', //客服电话
  92. payStatus:0,
  93. btnStatus:0, //按钮组件状态
  94. isRequest:false, //是否加载完成渲染子组件
  95. isOrderShare:false,
  96. isShareModal:false,
  97. isPayModel:false,
  98. modelType:0,
  99. ableUserMoney:'', //机构余额
  100. payModelData:{},
  101. addressData:{}, //地址信息初始化
  102. information:{}, //订单信息初始化
  103. shopOrderData:{}, //商品信息初始化
  104. orderInvoice:{}, //发票信息初始化
  105. returnedPurchaseList:{}, //退款信息初始化
  106. discernReceiptList:{}, //支付信息初始化
  107. receiptAmount:0, //支付金额
  108. returnedPurchaseFee:0, //退款金额
  109. navbarHeight:'',
  110. rechargeGoods:false,
  111. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  112. systeminfo: this.setSysteminfo(), //获取设备信息
  113. isIphoneX:this.$store.state.isIphoneX,
  114. CustomBar:this.CustomBar,// 顶部导航栏高度
  115. popupShow:false,
  116. handlerPros:{},
  117. nvabarData: { //顶部自定义导航
  118. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  119. title: '订单详情', // 导航栏 中间的标题
  120. },
  121. clauseData:{},
  122. }
  123. },
  124. onLoad(option){
  125. console.log(option)
  126. this.shareType = option.type;
  127. this.orderID = option.orderID
  128. if(this.shareType ==='share'){
  129. this.listType = 0
  130. this.isOrderShare = true
  131. }else if(option.type === 'confim' || option.type === 'search' || option.type === 'cash'){
  132. this.listType = 0
  133. }else{
  134. this.listType = option.listType
  135. }
  136. this.getHeaderTopHeight()
  137. this.initOrderDetaileData()
  138. },
  139. filters:{
  140. NumFormat(value) {//处理金额
  141. return Number(value).toFixed(2);
  142. },
  143. TextFormat(status) {//处理金额
  144. let HtmlText,
  145. typeTextObject={
  146. 0:'待确认',
  147. 4:'交易完成',
  148. 5:'订单完成',
  149. 6:'已关闭',
  150. 7:'交易全退',
  151. 77:'交易全退',
  152. 11:'待付款待发货',
  153. 12:'待付款部分发货',
  154. 13:'待付款已发货',
  155. 21:'部分付款待发货',
  156. 22:'部分付款部分发货',
  157. 23:'部分付款已发货',
  158. 31:'已付款待发货',
  159. 32:'已付款部分发货',
  160. 33:'已付款已发货',
  161. 111:'待付款待发货',
  162. };
  163. Object.keys(typeTextObject).forEach(key => {
  164. if(key == status){
  165. HtmlText = typeTextObject[key]
  166. }
  167. })
  168. return HtmlText
  169. },
  170. },
  171. methods: {
  172. openclauseConten(id){
  173. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  174. },
  175. initOrderDetaileData(){//初始化页面数据@参数:订单ID
  176. queryOrderDetails({ orderID : this.orderID }).then(response =>{
  177. let resData = response.data;
  178. this.isRequest = true
  179. this.rechargeGoods = resData.rechargeGoods
  180. this.userID = resData.order.userID
  181. this.shareCode = resData.shareCode
  182. this.addressData = resData.userInfo
  183. this.information = resData.order
  184. this.btnStatus = resData.order.status
  185. this.payStatus = resData.order.payStatus
  186. this.shopOrderData = resData.shopOrderList
  187. this.orderInvoice = resData.orderInvoice
  188. this.returnedPurchaseList = resData.returnedPurchaseList
  189. this.discernReceiptList = resData.discernReceiptList
  190. this.receiptAmount = resData.order.receiptAmount
  191. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  192. this.ableUserMoney = resData.ableUserMoney
  193. this.clauseData = resData.clause
  194. }).catch(error =>{
  195. this.$util.modal('提示','订单查询失败,请稍后重试~','确定','',false,() =>{
  196. this.$api.switchTabTo('/seller/pages/index/index')
  197. })
  198. })
  199. },
  200. handButtonConfirm(data){//监听点击时间的按钮类型并执行...
  201. this.handShowAlert(data)
  202. },
  203. handShowAlert(data){//判断点击的按钮类型并执行...
  204. switch(data.type){
  205. case 'delete':
  206. this.handOrderDetele();
  207. break;
  208. case 'cancel':
  209. this.handCenceConfirm();
  210. break;
  211. case 'confirm':
  212. this.handOrderConfirm(data)
  213. break;
  214. case 'balance':
  215. this.getOrderPaymentValidation(data)
  216. break;
  217. case 'again':
  218. this.handOrderAgain(data.orderId);
  219. break
  220. }
  221. },
  222. handOrderAgain(id){
  223. this.aganOrderID = id;
  224. this.SellerService.SellerCreateOrderAgain({orderId:this.aganOrderID,confirmFlag:0}).then(res =>{
  225. if(res.code==0){
  226. this.$api.navigateTo('/seller/pages/cart/cart');
  227. }
  228. }).catch(error =>{
  229. if(error.code== -3){
  230. this.showAgan = true;
  231. this.promptitle = error.msg;
  232. this.failList = error.data;
  233. }else if(error.code== -2){
  234. this.$util.modal('',error.msg,'确定','',false,() =>{})
  235. }else{
  236. this.$util.msg(error.msg,2000)
  237. }
  238. })
  239. },
  240. handOrderConfirm(data){//确认订单
  241. this.$util.modal('提示','确认此订单?','确定','取消',true,() =>{
  242. affirmOrder({orderID:this.orderID}).then(response =>{
  243. this.$util.msg(response.msg,2000,true,'success');
  244. this.initOrderDetaileData()
  245. }).catch(error =>{
  246. this.$util.msg(error.msg,2000)
  247. })
  248. })
  249. },
  250. hanldPaymentConfirm(data){//监听余额抵扣按钮
  251. switch(data.type){
  252. case 3:
  253. this.OrderService.OrderBalanceDeduction({orderId:this.orderID}).then(response =>{
  254. this.$util.msg('余额抵扣成功',2000)
  255. this.initOrderDetaileData()
  256. }).catch(error =>{
  257. this.$util.msg(error.msg,2000)
  258. })
  259. break;
  260. }
  261. },
  262. getOrderPaymentValidation(data){//监听根据付款状态做操作
  263. this.OrderService.OrderPaymentValidation({orderId:data.orderId}).then(response =>{
  264. let dataCode = response.data.code
  265. this.payModelData = response.data
  266. if(dataCode == -1){
  267. this.$util.modal('','订单已申请全部退款,无需再付款!','确定','',false,() =>{})
  268. }else{
  269. this.isPayModel = true;
  270. this.modelType = 3
  271. }
  272. }).catch(error =>{
  273. this.$util.msg(error.msg,2000)
  274. })
  275. },
  276. handOrderDetele(){//删除订单
  277. this.$util.modal('提示','确认删除该订单吗?','确定','取消',true,() =>{
  278. deleteOrder({orderID:this.orderID}).then(response =>{
  279. this.$util.msg(response.msg,2000,true,'success');
  280. setTimeout(() => {
  281. if(this.shareType ==='share'){
  282. this.$api.navigateTo('/seller/pages/index/index')
  283. }else{
  284. this.$api.navigateTo(`/seller/pages/order/order-list?type=detele&listType=${this.listType}`)
  285. }
  286. },500)
  287. }).catch(error =>{
  288. this.$util.msg(error.msg,2000)
  289. })
  290. })
  291. },
  292. handCenceConfirm(){//取消订单
  293. this.$util.modal('提示','确认取消该订单吗?','确定','取消',true,() =>{
  294. cancelOrder({orderID:this.orderID}).then(response =>{
  295. this.$util.msg(response.msg,2000,true,'success');
  296. this.initOrderDetaileData()
  297. }).catch(error =>{
  298. this.$util.msg(error.msg,2000)
  299. })
  300. })
  301. },
  302. hanldePopupFn(data){//监听活动内容
  303. this.popupShow = true
  304. this.handlerPros = data
  305. },
  306. onShareAppMessage(res){//分享转发
  307. this.isShareModal = false
  308. if (res.from === 'button') {
  309. // 来自页面内转发按钮
  310. }
  311. return {
  312. title: '您有新的订单,请点击查看~',
  313. path: `/pages/user/order/order-sharelogin?orderID=${this.orderID}&userID=${this.userID}&serviceProviderId=${this.serviceProviderId}`,
  314. imageUrl:'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  315. }
  316. },
  317. getHeaderTopHeight(){
  318. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  319. let headerPosi = this.headerBtnPosi
  320. let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
  321. height: headerPosi.height,
  322. width: headerPosi.width,
  323. // 胶囊top - 状态栏高度
  324. top: headerPosi.top - statusBarHeight,
  325. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  326. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  327. // 屏幕宽度 - 胶囊right
  328. right: this.systeminfo.screenWidth - headerPosi.right
  329. }
  330. this.navbarHeight= headerPosi.bottom + btnPosi.bottom// 原胶囊bottom + 现胶囊bottom
  331. },
  332. setHeaderBtnPosi(){
  333. // 获得胶囊按钮位置信息
  334. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  335. return headerBtnPosi
  336. },
  337. setSysteminfo(){
  338. let systeminfo;
  339. uni.getSystemInfo({ // 获取设备信息
  340. success: (res) => {
  341. systeminfo = res
  342. },
  343. })
  344. return systeminfo
  345. },
  346. },
  347. onShow() {
  348. this.$api.getStorage().then((resolve) =>{
  349. this.serviceProviderId = resolve.serviceProviderID
  350. })
  351. }
  352. }
  353. </script>
  354. <style lang="scss">
  355. page {
  356. height: auto;
  357. background:#F7F7F7;
  358. }
  359. .btn-hover{
  360. background: #FFFFFF;
  361. }
  362. .animation{
  363. /* transition: transform 0.3s ease;*/
  364. transition-property: transform;
  365. transition-duration: 0.3s;
  366. transition-timing-function: ease;
  367. }
  368. .invoice-balance{
  369. width: 702rpx;
  370. height: auto;
  371. padding:0 24rpx;
  372. background: #FFFFFF;
  373. float: left;
  374. margin-top: 24rpx;
  375. margin-bottom: 24rpx;
  376. .balabce-t{
  377. width: 100%;
  378. height: 86rpx;
  379. line-height: 86rpx;
  380. font-size: $font-size-28;
  381. color: $text-color;
  382. float: left;
  383. .balabce-t-le{
  384. float: left;
  385. font-weight: bold;
  386. }
  387. .balabce-t-ri{
  388. float: right;
  389. display: flex;
  390. align-items: center;
  391. .money{
  392. display: flex;
  393. float: left;
  394. }
  395. .checkbox-box{
  396. display: flex;
  397. width: 60rpx;
  398. float: left;
  399. height: 100%;
  400. font-size: $font-size-24;
  401. .checkbox{
  402. width: 40rpx;
  403. text-align: right;
  404. box-sizing: border-box;
  405. text-align: center;
  406. text-decoration: none;
  407. border-radius: 0;
  408. -webkit-tap-highlight-color: transparent;
  409. overflow: hidden;
  410. }
  411. }
  412. }
  413. }
  414. .balabce-b{
  415. width: 100%;
  416. float: left;
  417. overflow: hidden;
  418. .balabce-b-text{
  419. width: 100%;
  420. line-height: 58rpx;
  421. font-size: $font-size-24;
  422. color: #FF2A2A;
  423. text-align: right;
  424. float: right;
  425. }
  426. &.balabce-b--hide {
  427. padding: 0 0;
  428. height: 0px;
  429. line-height: 0px;
  430. }
  431. }
  432. }
  433. .clause{
  434. float: right;
  435. font-size: 24rpx;
  436. color: #999999;
  437. margin-top: 60rpx;
  438. margin-right: 24rpx;
  439. &.noclick{
  440. pointer-events: none;
  441. }
  442. .text{
  443. color: #1890f9;
  444. &.color-bg{
  445. color: #333333;
  446. }
  447. }
  448. }
  449. .status-text{
  450. overflow: hidden;
  451. padding: 24rpx;
  452. background: #fff;
  453. font-size: $font-size-26;
  454. .view-type{
  455. float: left;
  456. color: #ff2a2a;
  457. }
  458. .bage-buss{
  459. display: inline-block;
  460. width: 72rpx;
  461. height: 32rpx;
  462. background:radial-gradient(circle,rgba(255,39,180,1) 0%,rgba(193,77,245,1) 100%);
  463. border-radius: 6rpx;
  464. line-height: 32rpx;
  465. text-align: center;
  466. color: #FFFFFF;
  467. margin-top: 10rpx;
  468. float: right;
  469. font-size: $font-size-24;
  470. }
  471. .bage-auto{
  472. display: inline-block;
  473. width: 72rpx;
  474. height: 32rpx;
  475. background:radial-gradient(circle,rgba(255,180,39,1) 0%,rgba(245,142,77,1) 100%);
  476. border-radius: 6rpx;
  477. line-height: 32rpx;
  478. text-align: center;
  479. color: #FFFFFF;
  480. margin-top: 10rpx;
  481. float: right;
  482. font-size: $font-size-24;
  483. }
  484. .Rebate{
  485. display: inline-block;
  486. width: 72rpx;
  487. height: 32rpx;
  488. background:#ff7a51;
  489. border-radius: 6rpx;
  490. line-height: 32rpx;
  491. text-align: center;
  492. color: #FFFFFF;
  493. margin-top: 10rpx;
  494. float: right;
  495. font-size: $font-size-24;
  496. margin-left: 20rpx;
  497. }
  498. }
  499. </style>