order-list.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. <template>
  2. <view class="container" :style="{ paddingTop: navbarHeight + 'px' }">
  3. <!-- 自定义返回 -->
  4. <header-back
  5. :systeminfo="systeminfo"
  6. :navbar-data="nvabarData"
  7. :headerBtnPosi="headerBtnPosi"
  8. :isDelete="isDelete"
  9. @goSearchPath="handlSearchPath"
  10. />
  11. <tui-skeleton
  12. v-if="skeletonShow"
  13. backgroundColor="#fafafa"
  14. borderRadius="10rpx"
  15. :isLoading="true"
  16. :loadingType="5"
  17. />
  18. <template v-else>
  19. <view class="order-section-top" :style="{ marginTop: navbarHeight + 'px' }">
  20. <scroll-view scroll-x scroll-with-animation class="tab-view" :scroll-left="scrollLeft">
  21. <view
  22. v-for="(item, index) in orderTabBar"
  23. :key="index"
  24. class="tab-bar-item"
  25. :class="[currentTab == index ? 'active' : '']"
  26. :data-current="index"
  27. @tap.stop="onClickTab"
  28. >
  29. <text class="tab-bar-title">{{ item.text }}</text>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. <swiper
  34. class="tab-content"
  35. :current="currentTab"
  36. duration="80"
  37. @animationfinish="onChange"
  38. :style="{ height: winHeight + 'px' }"
  39. >
  40. <swiper-item v-for="(tabItem, index) in orderTabBar" :key="index" @touchmove.stop="">
  41. <scroll-view scroll-y class="scoll-y tui-skeleton" @scrolltolower="scrolltolower">
  42. <view :class="{ 'tui-order-list': scrollTop >= 0 }" class="tui-skeleton clearfix">
  43. <!-- 空白页 -->
  44. <empty
  45. v-if="tabItem.loaded === true && tabItem.orderList.length === 0"
  46. :typeIndex="currentTab"
  47. :navbarHeight="navbarHeight"
  48. />
  49. <!-- 列表 -->
  50. <view v-else class="tui-order-content">
  51. <view
  52. class="tui-order-item"
  53. v-for="(order, orderIndex) in tabItem.orderList"
  54. @click.stop="detail(order.shopOrderId)"
  55. :key="orderIndex"
  56. >
  57. <view class="order-title">
  58. <view class="order-title-t">
  59. <view class="order-title-tip tui-skeleton-fillet">
  60. {{ order.status | statusFilters }}
  61. </view>
  62. <text
  63. class="bage buss tui-skeleton-fillet"
  64. v-if="order.orderSubmitType == 3 || order.orderSubmitType == 4"
  65. >协销</text
  66. >
  67. <text
  68. class="bage auto tui-skeleton-fillet"
  69. v-if="
  70. order.orderSubmitType == 0 ||
  71. order.orderSubmitType == 1 ||
  72. order.orderSubmitType == 2
  73. "
  74. >自主</text
  75. >
  76. <image
  77. class="bage-icon"
  78. src="https://static.caimei365.com/app/img/icon/icon-type@3x.png"
  79. mode="widthFix"
  80. v-if="order.secondHandOrderFlag == 1"
  81. ></image>
  82. </view>
  83. </view>
  84. <view class="goods-title">
  85. <view v-if="order.shopPromotion" class="floor-item-act">
  86. <view class="floor-tags">{{ order.shopPromotion.name }}</view>
  87. </view>
  88. <view class="title-text" v-if="order.secondHandOrderFlag == 1"
  89. >{{ order.shopName }}
  90. <label class="paymenttext" v-if="order.affirmPaymentFlag == 1"
  91. >已确认打款供应商</label
  92. >
  93. </view>
  94. <view class="title-text tui-skeleton-fillet" v-else @click="goShophome(order)"
  95. >{{ order.shopName }}<label class="iconfont icon-jinrudianpu"></label
  96. ></view>
  97. </view>
  98. <view
  99. class="goods-item"
  100. v-for="(pros, prosIndex) in order.orderProductList"
  101. :key="prosIndex"
  102. >
  103. <view class="goods-pros-t">
  104. <view class="pros-img tui-skeleton-fillet">
  105. <image :src="pros.image" alt="" />
  106. <text class="tips" v-if="pros.giftType == 2 || pros.giftType == 1"
  107. >赠品</text
  108. >
  109. </view>
  110. <view class="pros-product clearfix">
  111. <view class="producttitle tui-skeleton-fillet">{{ pros.name }}</view>
  112. <view
  113. class="productspec tui-skeleton-fillet"
  114. v-if="pros.productCategory != 2"
  115. >规格:{{ pros.productUnit }}</view
  116. >
  117. <view class="productprice">
  118. <view
  119. class="price tui-skeleton-fillet"
  120. :class="
  121. pros.svipPriceFlag == 1 ||
  122. PromotionsFormat(pros.productPromotion)
  123. ? 'none'
  124. : ''
  125. "
  126. >
  127. <text>¥{{ pros.price | NumFormat }}</text>
  128. </view>
  129. <view class="count tui-skeleton-fillet">
  130. <text class="small">x</text>{{ pros.num }}
  131. </view>
  132. </view>
  133. <view class="floor-item-act">
  134. <template v-if="pros.productPromotion">
  135. <view
  136. v-if="PromotionsFormat(pros.productPromotion)"
  137. class="floor-tags"
  138. @click.stop="clickPopupShow(pros.productPromotion)"
  139. >
  140. {{ pros.productPromotion.name }}
  141. <text
  142. v-if="
  143. pros.productPromotion != null &&
  144. pros.productPromotion.type != 3
  145. "
  146. >
  147. :¥{{
  148. pros.productPromotion == null
  149. ? '0.00'
  150. : pros.productPromotion.touchPrice | NumFormat
  151. }}
  152. </text>
  153. </view>
  154. <view
  155. v-else-if="pros.productPromotion.type != 3"
  156. class="floor-tags"
  157. @click.stop="clickPopupShow(pros.productPromotion)"
  158. >{{ pros.productPromotion.name }}</view
  159. >
  160. </template>
  161. <template v-if="pros.svipPriceFlag == 1">
  162. <view class="svip-tags">
  163. <view class="tags">SVIP</view>
  164. <view class="price">{{ pros.svipPriceTag }}</view>
  165. </view>
  166. </template>
  167. </view>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="order-footer">
  172. <view class="order-footer-bot">
  173. <view class="count tui-skeleton-fillet">共{{ order.itemCount }}件商品</view>
  174. <view
  175. class="money tui-skeleton-fillet"
  176. v-if="order.status == 31 || order.status == 32 || order.status == 33"
  177. >
  178. 已支付:<label style="color:#f94b4b ;"
  179. >¥{{ order.receiptAmount | NumFormat }}</label
  180. >
  181. </view>
  182. <view class="money tui-skeleton-fillet" v-else>
  183. 待付总额:<label style="color:#f94b4b ;"
  184. >¥{{ order.obligation | NumFormat }}</label
  185. >
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 底部button -->
  190. <cm-list-button
  191. ref="orderButton"
  192. :status="order.status"
  193. :order="order"
  194. @buttonConfirm="handButtonConfirm"
  195. />
  196. </view>
  197. <!--加载loadding-->
  198. <tui-loadmore :visible="loadding" :index="3" type="black"/>
  199. <tui-nomore
  200. :visible="!pullUpOn"
  201. :backgroundColor="'#ffffff'"
  202. :text="nomoreText"
  203. />
  204. <!--加载loadding-->
  205. </view>
  206. </view>
  207. </scroll-view>
  208. </swiper-item>
  209. </swiper>
  210. </template>
  211. <!-- 付款弹窗 -->
  212. <cm-orderpay-popup
  213. v-if="isPayModel"
  214. :payModelData="payModelData"
  215. :modelType="modelType"
  216. @cancelConfirm="hanldCancelConfirm"
  217. @paymentConfirm="hanldPaymentConfirm"
  218. />
  219. <!-- 分享弹窗 -->
  220. <cm-share-popup :shopOrderId="handleShopOrderId" v-if="isShareModal" @shareConfirm="onShareAppMessage" />
  221. <!-- 采美豆提示弹窗 -->
  222. <activityBean
  223. v-if="isActivityBean"
  224. :show="isActivityBean"
  225. :beansType="beansType"
  226. :beanNumber="beanNumber"
  227. @cancel="handleBeanlClick"
  228. />
  229. <!-- 提示弹窗 -->
  230. <tui-modal
  231. :show="modal"
  232. @click="handleClick"
  233. :content="contentModalText"
  234. :button="modalButton"
  235. color="#333"
  236. :size="32"
  237. shape="circle"
  238. :maskClosable="false"
  239. />
  240. <!-- 透明模态层 -->
  241. <modal-layer v-if="isModalLayer" />
  242. </view>
  243. </template>
  244. <script>
  245. import { mapState, mapMutations } from 'vuex'
  246. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  247. import modalLayer from '@/components/modal-layer'
  248. import empty from '@/components/empty'
  249. import cmListButton from './components/cm-list-button' //底部按钮
  250. import cmSharePopup from './components/cm-share-popup' //分享弹窗
  251. import cmOrderpayPopup from './components/cm-orderpay-popup' //付款弹窗
  252. import activityBean from '@/components/cm-module/activity/activityBean.vue'
  253. export default {
  254. components: {
  255. headerBack,
  256. empty,
  257. modalLayer,
  258. cmListButton,
  259. cmSharePopup,
  260. cmOrderpayPopup,
  261. activityBean
  262. },
  263. data() {
  264. return {
  265. CustomBar: this.CustomBar, // 顶部导航栏高度
  266. orderTabBar: [
  267. { state: 0, text: '全部订单', orderList: [] },
  268. { state: 1, text: '待确认', orderList: [] },
  269. { state: 2, text: '待付款', orderList: [] },
  270. { state: 3, text: '待发货', orderList: [] },
  271. { state: 4, text: '已发货', orderList: [] },
  272. { state: 5, text: '退货/款', orderList: [] }
  273. ],
  274. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  275. systeminfo: this.setSysteminfo(), //获取设备信息
  276. nvabarData: {
  277. //顶部自定义导航
  278. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  279. showSearch: 1,
  280. title: '我的订单' // 导航栏 中间的标题
  281. },
  282. winHeight: '', //窗口高度
  283. currentTab: 0, //预设当前项的值
  284. scrollLeft: 0, //tab标题的滚动条位置
  285. listQuery: {
  286. orderState: 0,
  287. userId: 0,
  288. pageNum: 1,
  289. pageSize: 10
  290. },
  291. orderData: [],
  292. scrollTop: 0,
  293. skeletonShow: true,
  294. isDelete: false,
  295. isClickChange: false,
  296. isShareModal: false, //控制分享弹窗
  297. isModalLayer: false,
  298. isPayModel: false,
  299. loadding: false,
  300. pullUpOn: true,
  301. hasNextPage: false,
  302. pullFlag: true,
  303. navbarHeight: '',
  304. payModelData: {},
  305. modelType: 0,
  306. nomoreText: '上拉显示更多',
  307. isOnloadFlag: false,
  308. beansType: 1,
  309. beanNumber: 0,
  310. isActivityBean: false,
  311. handleShopOrderId: 0, //点击按钮传入的的子订单ID
  312. handleModelEven: 0,
  313. modal: false,
  314. contentModalText: '订单查询失败,请稍候重试~', //操作文字提示语句
  315. modalButton: [
  316. {
  317. text: '取消',
  318. type: 'gray',
  319. plain: true //是否空心
  320. },
  321. {
  322. text: '确定',
  323. customStyle: {
  324. color: '#fff',
  325. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  326. },
  327. plain: false
  328. }
  329. ]
  330. }
  331. },
  332. onLoad(e) {
  333. let self = this
  334. if (e.type === 'detele') {
  335. this.isDelete = true
  336. }
  337. this.currentTab = e.state
  338. this.isOnloadFlag = true
  339. this.getHeaderTopHeight() //设置自定义导航高度
  340. this.initStorage()
  341. },
  342. filters: {
  343. NumFormat(value) {
  344. //处理金额
  345. return Number(value).toFixed(2)
  346. },
  347. statusFilters(value) {
  348. //处理订单状态显示
  349. const map = {
  350. 0: '待确认',
  351. 2: '交易完成',
  352. 4: '已关闭',
  353. 5: '交易全退',
  354. 6: '交易全退',
  355. 11: '待付款待发货',
  356. 12: '待付款部分发货',
  357. 13: '待付款已发货',
  358. 21: '部分付款待发货',
  359. 22: '部分付款部分发货',
  360. 23: '部分付款已发货',
  361. 31: '已付款待发货',
  362. 32: '已付款部分发货',
  363. 33: '已付款已发货'
  364. }
  365. return map[value]
  366. }
  367. },
  368. computed: {
  369. ...mapState(['hasLogin'])
  370. },
  371. methods: {
  372. async initStorage() {
  373. //初始化
  374. if(this.hasLogin){
  375. const usrInfo = await this.$api.getStorage()
  376. this.listQuery.userId = usrInfo.userId ? usrInfo.userId : 0
  377. this.getOrderDatainit(this.currentTab)
  378. }else{
  379. this.skeletonShow = false
  380. this.modal = true
  381. this.contentModalText = '您还未登录,请先登录再进行操作'
  382. this.handleModelEven = 0
  383. this.modalButton = [
  384. {
  385. text: '暂不登录',
  386. type: 'gray',
  387. plain: true //是否空心
  388. },
  389. {
  390. text: '立即登录',
  391. customStyle: {
  392. color: '#fff',
  393. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  394. },
  395. plain: false
  396. }
  397. ]
  398. }
  399. },
  400. // 滚动切换标签样式
  401. onChange: function(e) {
  402. let index = e.target.current || e.detail.current
  403. if (this.isClickChange) {
  404. this.currentTab = index
  405. this.isClickChange = false
  406. return
  407. }
  408. this.isClickChange = false
  409. this.currentTab = index
  410. this.checkCor()
  411. this.pullUpOn = true //切换时隐藏
  412. this.loadding = false //切换时隐藏
  413. this.nomoreText = ''
  414. if (!this.isOnloadFlag) {
  415. this.getOrderDatainit(this.currentTab, 'tabChange')
  416. }
  417. },
  418. // 点击标题切换当前页时改变样式
  419. onClickTab(e) {
  420. let tabIndex = e.target.dataset.current || e.currentTarget.dataset.current
  421. if (this.currentTab === tabIndex) {
  422. return false
  423. } else {
  424. this.isClickChange = true
  425. this.currentTab = tabIndex
  426. this.pullUpOn = true //切换时隐藏
  427. this.loadding = false //切换时隐藏
  428. this.getOrderDatainit(this.currentTab)
  429. }
  430. },
  431. //判断当前滚动超过一屏时,设置tab标题滚动条。
  432. checkCor() {
  433. if (this.currentTab > 3) {
  434. //这里距离按实际计算
  435. this.scrollLeft = 300
  436. } else {
  437. this.scrollLeft = 0
  438. }
  439. },
  440. async getOrderDatainit(index, source) {
  441. let orderItem = this.orderTabBar[index]
  442. if (source === 'tabChange' && orderItem.loaded === true) {
  443. //tab切换只有第一次需要加载数据
  444. return
  445. }
  446. try {
  447. this.listQuery.pageNum = 1
  448. this.listQuery.orderState = index
  449. const res = await this.OrderService.QueryOrderList(this.listQuery)
  450. const data = res.data
  451. if(data.list.length>0){
  452. const orderList = data.list
  453. orderItem.orderList = []
  454. orderList.forEach(item => {
  455. orderItem.orderList.push(item)
  456. })
  457. //loaded新字段用于表示数据加载完毕,如果为空可以显示空白页
  458. this.$set(orderItem, 'loaded', true)
  459. this.hasNextPage = data.hasNextPage
  460. if (this.hasNextPage) {
  461. this.pullUpOn = false
  462. this.nomoreText = '上拉显示更多'
  463. } else {
  464. if (orderItem.orderList.length < 2) {
  465. this.pullUpOn = true
  466. } else {
  467. this.pullUpOn = false
  468. this.nomoreText = '已至底部'
  469. }
  470. }
  471. }else{
  472. this.$set(orderItem, 'loaded', true)
  473. orderItem.orderList = []
  474. }
  475. this.skeletonShow = false
  476. this.isOnloadFlag = false
  477. } catch (error) {
  478. this.$util.msg(error.msg, 2000)
  479. }
  480. },
  481. async getOnReachBottomData(index) {
  482. //上拉加载
  483. try {
  484. this.listQuery.pageNum += 1
  485. this.listQuery.orderState = index
  486. const res = await this.OrderService.QueryOrderList(this.listQuery)
  487. const data = res.data
  488. const orderItem = this.orderTabBar[index]
  489. this.hasNextPage = data.hasNextPage
  490. orderItem.orderList = orderItem.orderList.concat(data.list)
  491. this.pullFlag = false // 防上拉暴滑
  492. setTimeout(() => {
  493. this.pullFlag = true
  494. }, 500)
  495. if (this.hasNextPage) {
  496. this.pullUpOn = false
  497. this.nomoreText = '上拉显示更多'
  498. } else {
  499. this.loadding = false
  500. this.pullUpOn = false
  501. this.nomoreText = '已至底部'
  502. }
  503. } catch (error) {
  504. this.$util.msg(error.msg, 2000)
  505. }
  506. },
  507. handButtonConfirm(data) {
  508. //获取点击
  509. this.handleShopOrderId = data.shopOrderId
  510. switch (data.type) {
  511. case 'cancel': //取消订单
  512. this.modal = true
  513. this.contentModalText = '确认取消该订单吗?'
  514. this.handleModelEven = 1
  515. break
  516. case 'confirm': //确认收货
  517. this.modal = true
  518. this.contentModalText = '确认收货吗?'
  519. this.handleModelEven = 2
  520. break
  521. case 'delete': //删除订单
  522. this.modal = true
  523. this.contentModalText = '确认删除该订单吗?'
  524. this.handleModelEven = 3
  525. break
  526. case 'confirmation': // 确认订单
  527. this.modal = true
  528. this.contentModalText = '确认此订单吗?'
  529. this.handleModelEven = 4
  530. break
  531. case 'payment': //打款给供应商
  532. this.modal = true
  533. this.contentModalText = '确定委托采美平台打款给供应商吗?确定之前请务必确保货品完好!'
  534. this.handleModelEven = 5
  535. break
  536. case 'pay':
  537. this.getOrderPaymentValidation(data)
  538. break
  539. case 'query':
  540. this.isModalLayer = true
  541. this.$api.navigateTo('/pages/user/order/order-logistics?shopOrderId=' + data.shopOrderId)
  542. break
  543. case 'upload':
  544. this.$api.navigateTo('/pages/user/order/order-addpay?shopOrderId=' + data.shopOrderId)
  545. break
  546. }
  547. },
  548. handleClick(e) {
  549. //确认操作
  550. if (e.index == 1) {
  551. switch (this.handleModelEven) {
  552. case 0: //未登录
  553. this.$api.redirectTo('/pages/login/login')
  554. break
  555. case 1: //取消订单
  556. this.cancelOrder(this.handleShopOrderId)
  557. break
  558. case 2: //确认收货
  559. this.confirmReceipt(this.handleShopOrderId)
  560. break
  561. case 3: //删除订单
  562. this.deleteOrder(this.handleShopOrderId)
  563. break
  564. case 4: //确认订单
  565. this.affirmOrder(this.handleShopOrderId)
  566. break
  567. case 5: //打款给供应商
  568. this.confirmpayment(this.handleShopOrderId)
  569. break
  570. }
  571. }else{
  572. switch (this.handleModelEven) {
  573. case 0: //未登录
  574. this.$api.switchTabTo('/pages/tabBar/home/index')
  575. break
  576. }
  577. }
  578. this.modal = false
  579. },
  580. //取消订单
  581. async cancelOrder(shopOrderId) {
  582. try {
  583. const res = await this.OrderService.CancelOrder({ shopOrderId: shopOrderId, userIdentity: 0 })
  584. this.$util.msg(res.msg, 2000, true, 'success')
  585. setTimeout(() => {
  586. this.getOrderDatainit(this.currentTab)
  587. }, 2000)
  588. } catch (error) {
  589. this.$util.msg(error.msg, 2000)
  590. }
  591. },
  592. //确认收货
  593. async confirmReceipt(shopOrderId) {
  594. try {
  595. const res = await this.OrderService.ConfirmReceipt({ shopOrderId: shopOrderId })
  596. this.beansType = 7
  597. this.beanNumber = 100
  598. this.isActivityBean = true
  599. } catch (error) {
  600. this.$util.msg(error.msg, 2000)
  601. }
  602. },
  603. //删除订单
  604. async deleteOrder(shopOrderId) {
  605. try {
  606. const res = await this.OrderService.DeleteOrder({ shopOrderId: shopOrderId })
  607. this.$util.msg(res.msg, 2000, true, 'success')
  608. setTimeout(() => {
  609. this.getOrderDatainit(this.currentTab)
  610. }, 2000)
  611. } catch (error) {
  612. this.$util.msg(error.msg, 2000)
  613. }
  614. },
  615. //确认订单
  616. async affirmOrder(shopOrderId) {
  617. try {
  618. const res = await this.OrderService.AffirmOrder({ shopOrderId: shopOrderId })
  619. this.$util.msg(res.msg, 2000, true, 'success')
  620. setTimeout(() => {
  621. this.getOrderDatainit(this.currentTab)
  622. }, 2000)
  623. } catch (error) {
  624. this.$util.msg(error.msg, 2000)
  625. }
  626. },
  627. //确认打款给供应商
  628. async confirmpayment(shopOrderId) {
  629. try {
  630. const res = await this.OrderService.confirmpayment({ shopOrderId: shopOrderId })
  631. this.$util.msg(res.msg, 2000, true, 'success')
  632. setTimeout(() => {
  633. this.getOrderDatainit(this.currentTab)
  634. }, 2000)
  635. } catch (error) {
  636. this.$util.msg(error.msg, 2000)
  637. }
  638. },
  639. //监听根据付款状态做操作
  640. async getOrderPaymentValidation(order) {
  641. try {
  642. const res = await this.OrderService.OrderPaymentValidation({ shopOrderId: order.shopOrderId })
  643. const data = res.data
  644. this.payModelData = data
  645. if (data.balanceFlag == 1) {
  646. // 0可以走余额抵扣,1不能走余额抵扣
  647. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${order.order.shopOrderId}`)
  648. } else {
  649. switch (data.code) {
  650. case 1:
  651. this.isPayModel = true
  652. this.modelType = 1
  653. break
  654. case 2:
  655. this.isPayModel = true
  656. this.modelType = 2
  657. break
  658. case -1:
  659. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  660. break
  661. default:
  662. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${order.order.shopOrderId}`)
  663. }
  664. }
  665. } catch (error) {
  666. this.$util.msg(error.msg, 2000)
  667. }
  668. },
  669. //余额抵扣跳转
  670. async hanldPaymentConfirm(order) {
  671. try {
  672. await this.OrderService.OrderBalanceDeduction({ shopOrderId: order.order.shopOrderId })
  673. if (order.type === 2) {
  674. const data = { shopOrderId: order.order.shopOrderId }
  675. this.$api.navigateTo(
  676. `/pages/user/order/success?type=deduction&data=${JSON.stringify({ data: data })}`
  677. )
  678. } else {
  679. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${order.order.shopOrderId}`)
  680. }
  681. } catch (error) {
  682. this.$util.msg(error.msg, 2000)
  683. }
  684. },
  685. hanldCancelConfirm(data) {
  686. //不使用余额抵扣直接跳转收银台
  687. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${data.shopOrderId}`)
  688. },
  689. goShophome(order) {
  690. if (order.shopType === 2) {
  691. return
  692. }
  693. this.$api.navigateTo(`/pages/supplier/user/my-shop?shopId=${order.shopId}`)
  694. },
  695. detail(shopOrderId) {
  696. //订单详情跳转
  697. this.isModalLayer = true
  698. this.$api.navigateTo(`/pages/user/order/order-details?state=${this.currentTab}&shopOrderId=${shopOrderId}`)
  699. },
  700. handlSearchPath() {
  701. this.$api.navigateTo('/pages/user/order/search-order')
  702. },
  703. onShareAppMessage(res) {
  704. //分享转发
  705. this.isShareModal = false
  706. if (res.from === 'button') {
  707. // 来自页面内转发按钮
  708. }
  709. return {
  710. title: '您有新的分享订单,快来查看吧~',
  711. path: `/pages/user/order/order-sharelogin?shopOrderId=${this.handleShopOrderId}&userId=${this.userId}`,
  712. imageUrl: 'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  713. }
  714. },
  715. scrolltolower() {
  716. if (this.hasNextPage) {
  717. this.loadding = true
  718. this.pullUpOn = true
  719. this.getOnReachBottomData(this.currentTab)
  720. }
  721. },
  722. getHeaderTopHeight() {
  723. // 状态栏高度
  724. let self = this
  725. let statusBarHeight = this.systeminfo.statusBarHeight
  726. let headerPosi = this.headerBtnPosi
  727. let btnPosi = {
  728. // 胶囊实际位置,坐标信息不是左上角原点
  729. height: headerPosi.height,
  730. width: headerPosi.width,
  731. // 胶囊top - 状态栏高度
  732. top: headerPosi.top - statusBarHeight,
  733. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  734. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  735. // 屏幕宽度 - 胶囊right
  736. right: this.systeminfo.screenWidth - headerPosi.right
  737. }
  738. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  739. // 高度自适应
  740. uni.getSystemInfo({
  741. success: function(res) {
  742. let calc = res.windowHeight
  743. self.winHeight = calc - self.CustomBar
  744. }
  745. })
  746. },
  747. setHeaderBtnPosi() {
  748. // 获得胶囊按钮位置信息
  749. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  750. return headerBtnPosi
  751. },
  752. setSysteminfo() {
  753. let systeminfo
  754. uni.getSystemInfo({
  755. // 获取设备信息
  756. success: res => {
  757. systeminfo = res
  758. }
  759. })
  760. return systeminfo
  761. },
  762. PromotionsFormat(promo) {
  763. //促销活动类型数据处理
  764. if (promo != null) {
  765. if (promo.type == 1 && promo.mode == 1) {
  766. return true
  767. } else {
  768. return false
  769. }
  770. }
  771. return false
  772. },
  773. handleBeanlClick() {
  774. //关闭采美豆弹窗
  775. this.isActivityBean = false
  776. this.getOrderDatainit(this.currentTab)
  777. }
  778. },
  779. onPageScroll(e) {
  780. this.scrollTop = e.scrollTop
  781. },
  782. onShow() {
  783. this.isModalLayer = false
  784. this.initStorage()
  785. }
  786. }
  787. </script>
  788. <style lang="scss">
  789. /*tabbar start*/
  790. ::-webkit-scrollbar {
  791. width: 0;
  792. height: 0;
  793. color: transparent;
  794. }
  795. .order-section-top {
  796. width: 100%;
  797. position: fixed;
  798. top: 0;
  799. left: 0;
  800. z-index: 99;
  801. background: #ffffff;
  802. }
  803. .tab-view::before {
  804. content: '';
  805. position: absolute;
  806. border-bottom: 1rpx solid #eaeef1;
  807. -webkit-transform: scaleY(0.5);
  808. transform: scaleY(0.5);
  809. bottom: 0;
  810. right: 0;
  811. left: 0;
  812. }
  813. .tab-view {
  814. width: 100%;
  815. height: 80rpx;
  816. overflow: hidden;
  817. box-sizing: border-box;
  818. background: #fff;
  819. white-space: nowrap;
  820. border-top: 1px solid #f7f7f7;
  821. }
  822. .tab-bar-item {
  823. padding: 0;
  824. height: 80rpx;
  825. min-width: 80rpx;
  826. line-height: 80rpx;
  827. margin: 0 28rpx;
  828. display: inline-block;
  829. text-align: center;
  830. box-sizing: border-box;
  831. }
  832. .tab-bar-title {
  833. height: 80rpx;
  834. line-height: 80rpx;
  835. font-size: $font-size-28;
  836. color: $text-color;
  837. }
  838. .active {
  839. border-bottom: 6rpx solid $color-system;
  840. }
  841. .active .tab-bar-title {
  842. color: $color-system !important;
  843. }
  844. /*tabbar end*/
  845. .scoll-y {
  846. height: 100%;
  847. }
  848. page {
  849. background: #f7f7f7;
  850. }
  851. .container {
  852. padding-bottom: env(safe-area-inset-bottom);
  853. height: auto;
  854. position: relative;
  855. }
  856. .tui-order-content {
  857. width: 100%;
  858. height: auto;
  859. }
  860. .tui-order-list {
  861. margin-top: 90rpx;
  862. width: 100%;
  863. position: relative;
  864. }
  865. .tui-order-item {
  866. display: flex;
  867. flex-direction: column;
  868. width: 702rpx;
  869. padding: 20rpx 24rpx 0 24rpx;
  870. background: #fff;
  871. border-bottom: 20rpx solid #f7f7f7;
  872. }
  873. .order-title {
  874. width: 100%;
  875. height: auto;
  876. .order-title-t {
  877. width: 100%;
  878. height: 68rpx;
  879. float: left;
  880. line-height: 68rpx;
  881. position: relative;
  882. .bage-icon {
  883. width: 50rpx;
  884. height: 50rpx;
  885. display: block;
  886. position: absolute;
  887. right: 110rpx;
  888. top: 12rpx;
  889. }
  890. .bage{
  891. display: inline-block;
  892. width: 72rpx;
  893. height: 32rpx;
  894. margin: 19rpx 10rpx 0 10rpx;
  895. border-radius:16rpx 0;
  896. line-height: 32rpx;
  897. font-size: $font-size-22;
  898. text-align: center;
  899. color: #ffffff;
  900. float: right;
  901. &.buss{
  902. background: radial-gradient(circle, rgba(255, 39, 180, 1) 0%, rgba(193, 77, 245, 1) 100%);
  903. }
  904. &.auto{
  905. background: #7fba4f;
  906. color: #ffffff;
  907. }
  908. &.ebate{
  909. background: #ff7a51;
  910. }
  911. }
  912. .order-title-tip {
  913. float: left;
  914. font-size: $font-size-28;
  915. line-height: 68rpx;
  916. text-align: right;
  917. color: #ff2a2a;
  918. }
  919. }
  920. }
  921. .goods-title {
  922. width: 100%;
  923. height: 56rpx;
  924. float: left;
  925. margin-top: 10rpx;
  926. .floor-item-act {
  927. height: 56rpx;
  928. text-align: center;
  929. box-sizing: border-box;
  930. float: left;
  931. padding: 10rpx 0;
  932. margin-right: 12rpx;
  933. }
  934. .title-text {
  935. width: 400rpx;
  936. overflow: hidden;
  937. text-overflow: ellipsis;
  938. white-space: nowrap;
  939. float: left;
  940. font-size: $font-size-28;
  941. color: $text-color;
  942. text-align: left;
  943. line-height: 56rpx;
  944. font-weight: bold;
  945. .iconfont {
  946. color: #999999;
  947. font-size: 28rpx;
  948. margin-left: 10rpx;
  949. }
  950. .paymenttext {
  951. color: #f9a94b;
  952. font-size: $font-size-22;
  953. margin-left: 20rpx;
  954. }
  955. }
  956. }
  957. .goods-item {
  958. width: 100%;
  959. height: auto;
  960. }
  961. .goods-pros-t {
  962. width: 100%;
  963. height: auto;
  964. padding: 24rpx 0;
  965. .pros-img {
  966. float: left;
  967. width: 210rpx;
  968. height: 100%;
  969. border-radius: 10rpx;
  970. margin: 0 26rpx 0 0;
  971. position: relative;
  972. .tips {
  973. display: inline-block;
  974. width: 80rpx;
  975. height: 40rpx;
  976. background-image: linear-gradient(214deg, #ff4500 0%, #ff5800 53%, #ff4367 100%);
  977. line-height: 40rpx;
  978. text-align: center;
  979. font-size: $font-size-24;
  980. color: #ffffff;
  981. border-radius: 10rpx 0 10rpx 0;
  982. position: absolute;
  983. top: 0;
  984. left: 0;
  985. }
  986. image {
  987. width: 210rpx;
  988. height: 210rpx;
  989. border-radius: 10rpx;
  990. border: 1px solid #f3f3f3;
  991. }
  992. }
  993. }
  994. .pros-product {
  995. width: 460rpx;
  996. height: 100%;
  997. line-height: 36rpx;
  998. font-size: $font-size-26;
  999. position: relative;
  1000. float: left;
  1001. .producttitle {
  1002. width: 100%;
  1003. display: inline-block;
  1004. height: auto;
  1005. text-overflow: ellipsis;
  1006. display: -webkit-box;
  1007. word-break: break-all;
  1008. -webkit-box-orient: vertical;
  1009. -webkit-line-clamp: 2;
  1010. overflow: hidden;
  1011. margin-bottom: 8rpx;
  1012. }
  1013. .productspec {
  1014. height: 36rpx;
  1015. color: #999999;
  1016. margin: 30rpx 0;
  1017. }
  1018. .productprice {
  1019. height: 48rpx;
  1020. width: 100%;
  1021. float: left;
  1022. .price {
  1023. line-height: 48rpx;
  1024. font-size: $font-size-28;
  1025. width: 48%;
  1026. color: #ff2a2a;
  1027. float: left;
  1028. font-weight: bold;
  1029. &.none {
  1030. text-decoration: line-through;
  1031. color: #999999;
  1032. }
  1033. }
  1034. .count {
  1035. height: 100%;
  1036. float: right;
  1037. position: relative;
  1038. .small {
  1039. color: #666666;
  1040. }
  1041. }
  1042. }
  1043. .floor-item-act {
  1044. width: 100%;
  1045. height: 56rpx;
  1046. text-align: center;
  1047. box-sizing: border-box;
  1048. float: left;
  1049. padding: 0 0 10rpx 0;
  1050. }
  1051. }
  1052. .order-footer {
  1053. width: 100%;
  1054. height: 78rpx;
  1055. float: left;
  1056. margin-top: 20rpx;
  1057. .order-footer-bot {
  1058. width: 100%;
  1059. float: left;
  1060. height: 48rpx;
  1061. line-height: 48rpx;
  1062. font-size: $font-size-28;
  1063. color: $text-color;
  1064. .count {
  1065. width: 50%;
  1066. float: left;
  1067. text-align: left;
  1068. font-weight: bold;
  1069. }
  1070. .money {
  1071. width: 50%;
  1072. float: right;
  1073. text-align: right;
  1074. }
  1075. }
  1076. }
  1077. </style>