orderDetail.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="order-pages">
  3. <view class="order-info">
  4. <!-- 订单状态 -->
  5. <view class="order-status">
  6. <view class="status-title">{{orderInfo.orderState}}</view>
  7. <view v-if="orderInfo.orderState=='WAIT_PAY'" class="status-care">
  8. 请在 <text>2020-10-30</text>前付款,过期系统将自动取消订单
  9. </view>
  10. <view v-if="orderInfo.orderState=='CANCEL'" class="status-care">
  11. 超时未支付,系统已自动取消订单
  12. </view>
  13. </view>
  14. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  15. <!-- 地址 -->
  16. <view class="order-address">
  17. <view>
  18. <text class="address-title">{{orderInfo.receiveAddress}}</text>
  19. </view>
  20. <view>
  21. <text style="margin-right: 30upx;">{{orderInfo.receiverName}}</text>
  22. <text>{{orderInfo.receiverPhone}}</text>
  23. </view>
  24. </view>
  25. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  26. <!-- 商品列表 -->
  27. <view class="bundle-list" v-for="item in orderInfo.orderGoodsList" :key="item.id">
  28. <view class="img-cont">
  29. <image :src="item.goodsImages"></image>
  30. </view>
  31. <view>
  32. <view class="ellipsis-two">{{item.goodsName}}</view>
  33. <view class="bundle-num">
  34. <view><text class="price-num">{{item.payGold}}</text> <text class="price-text">乐豆</text></view>
  35. <view>X {{item.buyQty}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  40. <!-- 订单信息 -->
  41. <u-cell-group>
  42. <u-cell-item title="订单编号" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
  43. {{orderInfo.orderSn}}
  44. </u-cell-item>
  45. <u-cell-item title="下单时间" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
  46. {{orderInfo.orderTime}}
  47. </u-cell-item>
  48. <u-cell-item v-if="orderInfo.payTime" title="支付时间" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
  49. {{orderInfo.payTime}}
  50. </u-cell-item>
  51. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  52. <u-cell-item title="商品合计" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
  53. <text class="price-num">{{orderInfo.originalGold}}</text> <text class="price-text">乐豆</text>
  54. </u-cell-item>
  55. <u-cell-item title="运费" :value-style="{color: '#000',fontSize: '28upx'}" :arrow="false">
  56. 免运费
  57. </u-cell-item>
  58. <u-cell-item :title="(orderInfo.orderState=='待支付'||orderInfo.orderState=='已取消') ? '待支付':'实际支付'" :value-style="{color: '#000',fontSize: '28upx'}"
  59. :arrow="false">
  60. <text class="price-num">{{orderInfo.originalGold}}</text> <text class="price-text">乐豆</text>
  61. </u-cell-item>
  62. </u-cell-group>
  63. </view>
  64. <view v-if="orderInfo.orderState=='WAIT_PAY'" class="footer">
  65. <u-button @click="cancleOrder" type="error">去支付</u-button>
  66. </view>
  67. <!-- 提示用户设置支付密码 -->
  68. <u-modal v-model="showSetPswModal"
  69. content="请先设置支付密码,才能使用乐豆"
  70. show-cancel-button
  71. confirm-text="去设置"
  72. cancel-text="暂时放弃"
  73. @confirm="toSetPwd"
  74. @cancel="showSetPswModal=false"
  75. ></u-modal>
  76. <!-- 确认取消弹窗 -->
  77. <u-modal v-model="showLeavePsw"
  78. title="确认放弃支付吗?"
  79. content="您的订单在30分钟内未支付将被取消"
  80. show-cancel-button
  81. confirm-text="确认放弃"
  82. cancel-text="继续支付"
  83. @confirm="canclePay"
  84. @cancel="payAgain"
  85. ></u-modal>
  86. <!-- 确认支付弹窗 -->
  87. <u-popup mode="center" closeable @close="showLeavePsw=true" v-model="showInputPsw" width="500rpx" >
  88. <view class="slot-content">
  89. <view>确认支付</view>
  90. <view class="text-cont">
  91. <text class="num-big">{{totalPrice}}</text>乐豆
  92. </view>
  93. <view class="footer">
  94. <u-input v-model="password" maxlength="30" input-align="center" type="password" placeholder="请输入支付密码" />
  95. </view>
  96. </view>
  97. </u-popup>
  98. </view>
  99. </template>
  100. <script>
  101. import {
  102. orderDetail,
  103. cancleOrder
  104. } from '@/api/order.js'
  105. import {
  106. getLookUpDatas
  107. } from '@/api/data.js'
  108. export default {
  109. data() {
  110. return {
  111. orderInfo: {},
  112. totalPrice: 0, // 支付合计
  113. showSetPswModal: false, // 设置支付密码弹窗
  114. showInputPsw: false, // 打开输入密码弹窗
  115. showLeavePsw: false, // 打开确定放弃弹窗
  116. orderStatusList: []
  117. }
  118. },
  119. onLoad(options) {
  120. // 监听设置密码是否成功
  121. uni.$once('setPswSuccess', this.setPsw)
  122. if (options.id) {
  123. console.log(options.id)
  124. this.getOrderDetail(options.id)
  125. this.orderStatusList = this.$store.state.vuex_payStatus
  126. }
  127. },
  128. methods: {
  129. getOptionName(list, val) {
  130. if (val) {
  131. let p = list.find((item) => {
  132. return item.code == val
  133. })
  134. return p ? p.dispName : '-'
  135. }
  136. return '-'
  137. },
  138. // 获取订单详情
  139. getOrderDetail(id) {
  140. let payTypeList = this.$store.state.vuex_payType
  141. orderDetail({
  142. id: id
  143. }).then(res => {
  144. if (res.status == 200) {
  145. this.orderInfo = res.data
  146. } else {
  147. uni.showToast({
  148. title: res.message,
  149. icon: 'none'
  150. })
  151. }
  152. })
  153. },
  154. // 跳转到设置支付密码页
  155. toSetPwd () {
  156. uni.navigateTo({
  157. url:"/pages/userCenter/userInfo/paymentPwd"
  158. })
  159. },
  160. // 设置密码成功, 打开输入密码弹窗
  161. setPsw (e) {
  162. if (e.success) {
  163. this.showInputPsw = true
  164. }
  165. },
  166. //确认放弃
  167. canclePay() {
  168. this.showLeavePsw = false
  169. this.showInputPsw = false
  170. },
  171. // 继续支付
  172. payAgain () {
  173. this.showLeavePsw = false
  174. this.showInputPsw = true
  175. },
  176. // 支付
  177. toPay(item) {
  178. // this.totalPrice = item.payGold
  179. // this.showSetPswModal = true
  180. // return
  181. signPay({id:item.id}).then(res=>{
  182. this.btnLoading = false
  183. if(res.status == 200) {
  184. // 跳转到支付完成界面
  185. uni.navigateTo({
  186. url:"/pages/toOrder/payFinish?id=" + this.orderId
  187. })
  188. } else{
  189. uni.showToast({
  190. title: res.message,
  191. icon: 'none'
  192. })
  193. }
  194. })
  195. },
  196. },
  197. }
  198. </script>
  199. <style lang="scss">
  200. page {
  201. height: 100%;
  202. background-color: #fff;
  203. }
  204. .order-pages {
  205. width: 100%;
  206. height: 100%;
  207. padding: 0 24upx;
  208. display: flex;
  209. flex-direction: column;
  210. .order-info {
  211. width: 100%;
  212. flex: 1;
  213. overflow-y: scroll;
  214. // 状态
  215. .order-status {
  216. padding: 30upx 0;
  217. text-align: center;
  218. .status-title {
  219. font-size: 36upx;
  220. color: #000;
  221. }
  222. .status-care {
  223. font-size: 24upx;
  224. margin-top: 10upx;
  225. color: #a9aaac;
  226. >text {
  227. color: red;
  228. }
  229. }
  230. }
  231. // 地址
  232. .order-address {
  233. font-size: 32upx;
  234. padding: 20upx 0;
  235. >view {
  236. line-height: 60upx;
  237. }
  238. .address-title {
  239. color: #000;
  240. }
  241. }
  242. // 订单中商品列表
  243. .bundle-list {
  244. display: flex;
  245. padding: 20upx 10upx;
  246. font-size: 28upx;
  247. border-bottom: 1px solid #F8F8F8;
  248. .img-cont {
  249. width: 158rpx;
  250. height: 140upx;
  251. border-radius: 15upx;
  252. overflow: hidden;
  253. >image {
  254. width: 100%;
  255. height: 100%;
  256. }
  257. }
  258. >view {
  259. &:last-child {
  260. flex: 1;
  261. margin-left: 20upx;
  262. display: flex;
  263. flex-direction: column;
  264. justify-content: space-between;
  265. }
  266. }
  267. .bundle-num {
  268. display: flex;
  269. justify-content: space-between;
  270. }
  271. }
  272. .price-text {
  273. font-size: 20upx;
  274. margin-left: 10upx;
  275. }
  276. .price-num {
  277. font-size: 32upx;
  278. color: red;
  279. }
  280. .u-cell {
  281. padding: 10rpx 32rpx;
  282. }
  283. }
  284. .footer {
  285. padding: 20rpx;
  286. }
  287. }
  288. </style>