orderDetail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="order-pages">
  3. <view class="order-info">
  4. <!-- 订单状态 -->
  5. <view class="order-status">
  6. <view class="status-title">{{orderInfo.orderStateDictValue}}</view>
  7. <view v-if="orderInfo.orderState=='WAIT_PAY'" class="status-care">
  8. 请在 <text>29</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=='WAIT_PAY'||orderInfo.orderState=='CANCEL') ? '待支付':'实际支付'" :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="toPay" 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"
  95. @confirm="toPayOrder"
  96. maxlength="30" input-align="center" type="password"
  97. placeholder="请输入支付密码" />
  98. </view>
  99. <view class="fot-btn">
  100. <u-button @click="toPayOrder" type="error" >确认支付</u-button>
  101. </view>
  102. </view>
  103. </u-popup>
  104. </view>
  105. </template>
  106. <script>
  107. import {
  108. orderDetail,
  109. signPay,
  110. existPayPwd
  111. } from '@/api/order.js'
  112. import {
  113. getLookUpDatas
  114. } from '@/api/data.js'
  115. export default {
  116. data() {
  117. return {
  118. orderInfo: {},
  119. totalPrice: 0, // 支付合计
  120. password: '', // 支付密码
  121. showSetPswModal: false, // 设置支付密码弹窗
  122. showInputPsw: false, // 打开输入密码弹窗
  123. showLeavePsw: false, // 打开确定放弃弹窗
  124. orderStatusList: []
  125. }
  126. },
  127. onLoad(options) {
  128. // 监听设置密码是否成功
  129. uni.$once('setPswSuccess', this.setPsw)
  130. if (options.id) {
  131. console.log(options.id)
  132. this.getOrderDetail(options.id)
  133. this.orderStatusList = this.$store.state.vuex_payStatus
  134. }
  135. },
  136. methods: {
  137. // 获取订单详情
  138. getOrderDetail(id) {
  139. let payTypeList = this.$store.state.vuex_payType
  140. orderDetail({
  141. id: id
  142. }).then(res => {
  143. if (res.status == 200) {
  144. this.orderInfo = res.data
  145. } else {
  146. uni.showToast({
  147. title: res.message,
  148. icon: 'none'
  149. })
  150. }
  151. })
  152. },
  153. // 跳转到设置支付密码页
  154. toSetPwd () {
  155. uni.navigateTo({
  156. url:"/pages/userCenter/userInfo/paymentPwd"
  157. })
  158. },
  159. // 设置密码成功, 打开输入密码弹窗
  160. setPsw (e) {
  161. if (e.success) {
  162. this.showInputPsw = true
  163. }
  164. },
  165. //确认放弃
  166. canclePay() {
  167. this.showLeavePsw = false
  168. this.showInputPsw = false
  169. },
  170. // 继续支付
  171. payAgain () {
  172. this.showLeavePsw = false
  173. this.showInputPsw = true
  174. },
  175. // 支付 判断用户是否设置过支付密码
  176. toPay() {
  177. this.totalPrice = this.orderInfo.originalGold
  178. // 判断用户是否设置过支付密码
  179. existPayPwd().then(res=>{
  180. console.log(res,'rrrrrr')
  181. if(res.status == 200) {
  182. // 设置过支付密码,输入密码
  183. if(res.data) {
  184. this.showInputPsw = true
  185. } else {
  186. // 没设置过支付密码,提示设置密码
  187. this.showSetPswModal = true
  188. }
  189. } else {
  190. uni.showToast({
  191. title: res.message,
  192. icon: 'none'
  193. })
  194. }
  195. })
  196. },
  197. // 支付
  198. toPayOrder() {
  199. let id = this.orderInfo.id
  200. let params = {
  201. payPwd: this.password,
  202. id: id
  203. }
  204. signPay(params).then(res=>{
  205. this.btnLoading = false
  206. if(res.status == 200) {
  207. // 跳转到支付完成界面
  208. uni.navigateTo({
  209. url:"/pages/toOrder/payFinish?id=" + id
  210. })
  211. } else{
  212. uni.showToast({
  213. title: res.message,
  214. icon: 'none'
  215. })
  216. }
  217. })
  218. },
  219. },
  220. }
  221. </script>
  222. <style lang="scss">
  223. page {
  224. height: 100%;
  225. background-color: #fff;
  226. }
  227. .order-pages {
  228. width: 100%;
  229. height: 100%;
  230. padding: 0 24upx;
  231. display: flex;
  232. flex-direction: column;
  233. .order-info {
  234. width: 100%;
  235. flex: 1;
  236. overflow-y: scroll;
  237. // 状态
  238. .order-status {
  239. padding: 30upx 0;
  240. text-align: center;
  241. .status-title {
  242. font-size: 36upx;
  243. color: #000;
  244. }
  245. .status-care {
  246. font-size: 24upx;
  247. margin-top: 10upx;
  248. color: #a9aaac;
  249. >text {
  250. color: red;
  251. }
  252. }
  253. }
  254. // 地址
  255. .order-address {
  256. font-size: 32upx;
  257. padding: 20upx 0;
  258. >view {
  259. line-height: 60upx;
  260. }
  261. .address-title {
  262. color: #000;
  263. }
  264. }
  265. // 订单中商品列表
  266. .bundle-list {
  267. display: flex;
  268. padding: 20upx 10upx;
  269. font-size: 28upx;
  270. border-bottom: 1px solid #F8F8F8;
  271. .img-cont {
  272. width: 158rpx;
  273. height: 140upx;
  274. border-radius: 15upx;
  275. overflow: hidden;
  276. >image {
  277. width: 100%;
  278. height: 100%;
  279. }
  280. }
  281. >view {
  282. &:last-child {
  283. flex: 1;
  284. margin-left: 20upx;
  285. padding: 10upx 0;
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: space-between;
  289. }
  290. }
  291. .bundle-num {
  292. display: flex;
  293. justify-content: space-between;
  294. }
  295. }
  296. .price-text {
  297. font-size: 20upx;
  298. margin-left: 10upx;
  299. }
  300. .price-num {
  301. font-size: 32upx;
  302. color: red;
  303. }
  304. .u-cell {
  305. padding: 10rpx 32rpx;
  306. }
  307. }
  308. .footer {
  309. padding: 20rpx;
  310. }
  311. // 支付密码弹窗
  312. .slot-content{
  313. padding: 30upx 0;
  314. display: flex;
  315. flex-direction: column;
  316. align-items: center;
  317. justify-content: space-between;
  318. .text-cont{
  319. width: 100%;
  320. padding: 60upx 0;
  321. text-align: center;
  322. .num-big{
  323. font-size: 40upx;
  324. color: red;
  325. }
  326. }
  327. .footer{
  328. width: 80%;
  329. border-bottom: 1px solid #b1b1b1;
  330. margin-bottom: 30upx;
  331. }
  332. }
  333. }
  334. </style>