order-list.vue 28 KB

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