order-confirmed.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="container details clearfix" :class="orderInfo.status !== 0 ? 'none' : ''">
  3. <tui-skeleton
  4. v-if="!skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. />
  10. <template v-else>
  11. <!-- 地址信息 -->
  12. <cm-address-temp ref="orderAddress" v-if="skeletonShow" :addressData="addressData" />
  13. <!-- 商品信息 -->
  14. <cm-goods-temp ref="goods" v-if="skeletonShow" :list="orderInfo.orderProductList" :orderInfo="orderInfo" />
  15. <!-- 订单信息 -->
  16. <cm-order-temp ref="information" v-if="skeletonShow" :information="orderInfo" />
  17. <!-- 发票信息 -->
  18. <cm-invice-temp ref="invoice" v-if="skeletonShow" :orderInvoice="orderInvoice" />
  19. <template v-if="orderInfo.status === 0">
  20. <view class="tips-text" >
  21. <text class="iconfont icon-tishi"></text>
  22. 点击下方按钮对订单进行确认。若未登录账号,将跳转到登录
  23. 页面进行机构账号登录/注册,登录/注册成功后再操作确认订
  24. 单。
  25. </view>
  26. <!-- 底部按钮 -->
  27. <view class="button-content" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  28. <view class="btn btn-query" @click.stop="handleConfirmOrder">确认订单</view>
  29. </view>
  30. </template>
  31. </template>
  32. <!-- 提示弹窗 -->
  33. <tui-modal
  34. :show="modal"
  35. @click="handleClick"
  36. :content="contentModalText"
  37. :button="modalButton"
  38. color="#333"
  39. :size="32"
  40. shape="circle"
  41. :maskClosable="false"
  42. />
  43. </view>
  44. </template>
  45. <script>
  46. import { mapState, mapMutations } from 'vuex'
  47. import authorize from '@/common/config/authorize.js'
  48. import wxLogin from '@/common/config/wxLogin.js'
  49. import cmAddressTemp from './components/details/cm-address-temp' //地址信息
  50. import cmGoodsTemp from './components/details/cm-goods-temp' //商品列表
  51. import cmInviceTemp from './components/details/cm-invice-temp' //发票信息
  52. import cmOrderTemp from './components/details/cm-order-temp' //订单信息
  53. export default {
  54. components: {
  55. cmAddressTemp,
  56. cmGoodsTemp,
  57. cmOrderTemp,
  58. cmInviceTemp
  59. },
  60. data() {
  61. return {
  62. status: '',
  63. userId: '',
  64. orderId: '',
  65. shopOrderId: '',
  66. skeletonShow: false,
  67. cellPhone: '', //客服电话
  68. btnStatus: 0, //按钮组件状态
  69. addressData: {}, //地址信息初始化
  70. orderInfo: {}, //订单信息初始化
  71. orderInvoice: {}, //发票信息初始化
  72. returnedPurchaseList: {}, //退款信息初始化
  73. discernReceiptList: {}, //支付信息初始化
  74. voucherList: [], //支付凭证
  75. receiptAmount: 0, //支付金额
  76. returnedPurchaseFee: 0, //退款金额
  77. isIphoneX: this.$store.state.isIphoneX,
  78. popupShow: false,
  79. handlerPros: {},
  80. modal: false,
  81. contentModalText: '确定订单无误,要确认订单吗?', //操作文字提示语句
  82. modalButton: [
  83. {
  84. text: '取消',
  85. type: 'gray',
  86. plain: true //是否空心
  87. },
  88. {
  89. text: '确定',
  90. customStyle: {
  91. color: '#fff',
  92. bgColor: '#F3B574'
  93. },
  94. plain: false
  95. }
  96. ]
  97. }
  98. },
  99. computed: {
  100. ...mapState(['hasLogin'])
  101. },
  102. onLoad(option) {
  103. this.shopOrderId = option.shopOrderId
  104. wxLogin.wxLoginAuthorize()
  105. this.getShopOrderById(option.shopOrderId)
  106. },
  107. methods: {
  108. async getShopOrderById(shopOrderId) {
  109. try {
  110. const res = await this.OrderService.getShopOrderById({ shopOrderId: shopOrderId })
  111. const data = res.data
  112. this.skeletonShow = true
  113. this.status = data.shopOrder.status
  114. this.addressData = data.userInfo
  115. this.orderInfo = data.shopOrder
  116. this.orderInvoice = data.orderInvoice
  117. this.returnedPurchaseList = data.returnedPurchaseList
  118. this.discernReceiptList = data.discernReceiptList
  119. this.receiptAmount = data.shopOrder.receiptAmount
  120. this.returnedPurchaseFee = data.shopOrder.returnedPurchaseFee
  121. this.voucherList = data.voucher
  122. this.mapStateArr.forEach(el => {
  123. el.val.forEach(value => {
  124. if (this.status === value) {
  125. this.btnState[el.label] = el.status
  126. }
  127. })
  128. })
  129. } catch (error) {
  130. this.$util.msg(error.msg, 2000)
  131. }
  132. },
  133. //按钮点击事件
  134. handleConfirmOrder() {
  135. if(!this.hasLogin){
  136. const pages = getCurrentPages()
  137. const page = pages[pages.length - 1]
  138. console.log('fullPath',page.$page.fullPath)
  139. uni.setStorageSync('LOGIN_REDIRECT_URL', page.$page.fullPath)
  140. this.$api.redirectTo('/pages/login/login')
  141. }else{
  142. this.modal = true
  143. }
  144. },
  145. // 确认操作
  146. handleClick(e) {
  147. if (e.index == 1) {
  148. this.confirmShopOrder(this.shopOrderId)
  149. }
  150. this.modal = false
  151. },
  152. //确认订单
  153. async confirmShopOrder(shopOrderId) {
  154. try {
  155. const usrInfo = await this.$api.getStorage()
  156. const res = await this.OrderService.confirmShopOrder({ shopOrderId: shopOrderId,userId:usrInfo.userId })
  157. this.$util.msg('订单确认成功~', 2000, true, 'success')
  158. setTimeout(() => {
  159. this.$api.redirectTo(`/pages/user/order/order-details?type=share&shopOrderId=${shopOrderId}`)
  160. }, 2000)
  161. } catch (error) {
  162. this.$util.msg(error.msg, 2000)
  163. }
  164. },
  165. },
  166. onShow() {}
  167. }
  168. </script>
  169. <style lang="scss">
  170. page {
  171. height: auto;
  172. background: #f7f7f7;
  173. }
  174. .details {
  175. padding-bottom: 180rpx;
  176. &.none{
  177. padding-bottom: 0;
  178. }
  179. }
  180. .btn-hover {
  181. background: #ffffff;
  182. }
  183. .animation {
  184. /* transition: transform 0.3s ease;*/
  185. transition-property: transform;
  186. transition-duration: 0.3s;
  187. transition-timing-function: ease;
  188. }
  189. .invoice-balance {
  190. width: 702rpx;
  191. height: auto;
  192. padding: 0 24rpx;
  193. background: #ffffff;
  194. float: left;
  195. margin-top: 24rpx;
  196. margin-bottom: 24rpx;
  197. .balabce-t {
  198. width: 100%;
  199. height: 86rpx;
  200. line-height: 86rpx;
  201. font-size: $font-size-28;
  202. color: $text-color;
  203. float: left;
  204. .balabce-t-le {
  205. float: left;
  206. font-weight: bold;
  207. }
  208. .balabce-t-ri {
  209. float: right;
  210. display: flex;
  211. align-items: center;
  212. .money {
  213. display: flex;
  214. float: left;
  215. }
  216. .checkbox-box {
  217. display: flex;
  218. width: 60rpx;
  219. float: left;
  220. height: 100%;
  221. font-size: $font-size-24;
  222. .checkbox {
  223. width: 40rpx;
  224. text-align: right;
  225. box-sizing: border-box;
  226. text-align: center;
  227. text-decoration: none;
  228. border-radius: 0;
  229. -webkit-tap-highlight-color: transparent;
  230. overflow: hidden;
  231. }
  232. }
  233. }
  234. }
  235. .balabce-b {
  236. width: 100%;
  237. float: left;
  238. overflow: hidden;
  239. .balabce-b-text {
  240. width: 100%;
  241. line-height: 58rpx;
  242. font-size: $font-size-24;
  243. color: #ff2a2a;
  244. text-align: right;
  245. float: right;
  246. }
  247. &.balabce-b--hide {
  248. padding: 0 0;
  249. height: 0px;
  250. line-height: 0px;
  251. }
  252. }
  253. }
  254. .tips-text{
  255. width: 100%;
  256. height: auto;
  257. box-sizing: border-box;
  258. padding: 30rpx;
  259. font-size: $font-size-24;
  260. color: #F94B4B;
  261. float: left;
  262. line-height: 40rpx;
  263. }
  264. .button-content {
  265. width: 702rpx;
  266. padding:24rpx 24rpx 0 24rpx;
  267. height: auto;
  268. background: #ffffff;
  269. position: fixed;
  270. bottom: 0;
  271. left: 0;
  272. .btn {
  273. width: 600rpx;
  274. height: 90rpx;
  275. line-height: 90rpx;
  276. font-size: $font-size-32;
  277. color: #ffffff;
  278. text-align: center;
  279. border-radius: 45rpx;
  280. background: #F3B574;
  281. margin: 0 auto;
  282. }
  283. }
  284. </style>