order-details.vue 16 KB

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