order-list-retail.vue 40 KB

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