orderdetails.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="">
  3. <u-navbar
  4. :title="title"
  5. @leftClick="leftClick"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. >
  9. </u-navbar>
  10. <view class="addr page-wrap u-flex u-row-between">
  11. <view class="left">
  12. <view class="top">
  13. <text class="label" v-if="orderDetails.ifDefault">默认</text>{{orderDetails.address||''}}
  14. </view>
  15. <view class="center">{{orderDetails.receiveAdress}}</view>
  16. <view class="bottom">{{orderDetails.receiveName}} {{orderDetails.receivePhone}}</view>
  17. </view>
  18. <!-- <u-icon name="arrow-right" color="#676767" size="20" @click="selectAddr"></u-icon> -->
  19. </view>
  20. <!-- <view class="payway page-wrap u-flex u-row-between">
  21. <view class="left">支付方式</view>
  22. <view class="u-flex">
  23. 微信支付
  24. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  25. </view>
  26. </view> -->
  27. <view class="order-product page-wrap">
  28. <view class="product u-flex" v-for="(item,index) in orderDetails.detailList" :key="item.id">
  29. <u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
  30. <view class="text">
  31. <view class="up">
  32. <view class="name ellipsis-2">{{item.goodsName}}</view>
  33. <view class="info">
  34. {{item.specification}}
  35. {{item.unit}}
  36. </view>
  37. </view>
  38. <view class="down u-flex u-row-between">
  39. <view class="left">
  40. <text class="price">¥ <text class="price-num">{{item.price}}</text></text>
  41. </view>
  42. <u-number-box v-model="item.quantity" :disabled="true" @change="changeQuantity(index, $event)" integer></u-number-box>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- <view class="page-wrap order-reduced">
  48. <view class="reduced-item u-flex u-row-between u-border-bottom">
  49. <view class="left">
  50. <text>优惠券</text>
  51. <text class="label">已选一张</text>
  52. </view>
  53. <view class="right u-flex">
  54. <text class="price red">-¥ <text class="price-num">1000</text></text>
  55. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  56. </view>
  57. </view>
  58. <view class="reduced-item integral u-flex u-row-between">
  59. <view class="left">
  60. <text>积分</text>
  61. <text class="num">3676</text>
  62. <text class="tip">满1000可用</text>
  63. </view>
  64. <view class="right u-flex">
  65. <text class="price red" v-if="useIntegral">-¥ <text class="price-num">1000</text></text>
  66. <u-checkbox-group @change="integralCheckboxChange">
  67. <u-checkbox shape="circle" activeColor="#02AB35" name="integral" ></u-checkbox>
  68. </u-checkbox-group>
  69. </view>
  70. </view>
  71. </view> -->
  72. <view class="page-wrap total">
  73. <view class="total-item u-flex u-row-between u-border-bottom">
  74. <view class="left">
  75. 商品金额
  76. </view>
  77. <view class="right red">
  78. ¥ {{orderDetails.originalOrderPrice}}
  79. </view>
  80. </view>
  81. <view class="total-item u-flex u-row-between">
  82. <view class="left">
  83. 运费
  84. <!-- <text class="gray">总重:{{totalWeight}}</text> -->
  85. </view>
  86. <view class="right red">
  87. <text v-if="orderDetails.originalFreightPrice">+ ¥ {{orderDetails.originalFreightPrice}}</text>
  88. <text v-else>免运费</text>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="cart-bottom">
  93. <view class="inner u-flex u-row-between">
  94. <view class="left u-flex">
  95. <view class="total-price" v-if="orderDetails.status==0">
  96. 待支付:<text class="red">¥ {{orderDetails.orderPrice}}</text>
  97. </view>
  98. </view>
  99. <!-- <view class="btn" @click="submitOrder">去结算</view> -->
  100. <view class="btn-wrap u-flex">
  101. <view
  102. class="btn"
  103. :class="btn.class"
  104. @click.stop="clickEven(btn.fun,orderDetails)"
  105. v-for="(btn,index) in statusBtn[orderDetails.status]" :key="index">
  106. {{btn.name}}
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. id:'',
  118. title:'订单详情',
  119. orderDetails:{},
  120. fromPage:'',
  121. useIntegral:false,
  122. dataList:[],
  123. theAddr:{},
  124. isDefaultAddr:false,
  125. statusBtn:{
  126. 0:[{name:'取消订单',fun:'cancel ',class:'cancel'},{name:'去支付',fun:'pay',class:'red'}],
  127. 1:[{name:'申请退款',fun:'refund',class:'green'}],
  128. 2:[{name:'查看物流',fun:'logistics',class:''},{name:'确认收货',fun:'confirmReceipt',class:'green'}],
  129. 3:[{name:'查看物流',fun:'logistics',class:''},{name:'评价',fun:'evaluate',class:'green'}],
  130. // 4:[{name:'查看物流',fun:'logistics',class:''},{name:'评价',fun:'evaluate',class:'green'}],
  131. 5:[{name:'查看退款',fun:'viewRefund',class:'green'}],
  132. // 6:[{name:'查看退款',fun:'viewRefund',class:'green'}],
  133. // 7:[{name:'查看退款',fun:'viewRefund',class:'green'}]
  134. }
  135. }
  136. },
  137. onLoad(page) {
  138. console.log('page',page);
  139. this.id = page.id;
  140. this.getOrderDetails(this.id);
  141. },
  142. onShow() {
  143. },
  144. methods: {
  145. leftClick(){
  146. console.log('orderdetails leftClick');
  147. },
  148. getOrderDetails(id){
  149. this.$u.api.orderDetails({id:id}).then(res=>{
  150. this.orderDetails = res.data
  151. console.log('orderDetails',JSON.parse(JSON.stringify(res.data)));
  152. }).catch(err=>{
  153. console.log('getOrderDetails',err);
  154. })
  155. },
  156. clickEven(fun,item){
  157. // console.log('fun',fun);
  158. let funObj = {
  159. 'pay': this.pay
  160. };
  161. if (fun in funObj) {
  162. funObj[fun](item);
  163. }
  164. },
  165. pay(item){
  166. console.log('pay',item);
  167. uni.$u.route('/shopping/pay', {
  168. orderId: this.orderDetails.id,
  169. // openid: that.vuex_wechatOpenid,
  170. payAmount:this.orderDetails.orderPrice
  171. });
  172. },
  173. }
  174. }
  175. </script>
  176. <style>
  177. page{
  178. background-color: #F5F5F5;
  179. /* padding-top: 50px; */
  180. }
  181. </style>
  182. <style lang="scss" scoped>
  183. .page-wrap{
  184. background-color: #fff;
  185. margin-bottom: 20rpx;
  186. }
  187. .addr{
  188. .top{
  189. margin-bottom: 16rpx;
  190. font-size: 26rpx;
  191. color: #999;
  192. .label{
  193. background-color: #FFEBEB;
  194. border: 1px solid #FF5F62;
  195. color: #FF5F62;
  196. padding: 5rpx 20rpx;
  197. border-radius: 30rpx;
  198. margin-right: 10rpx;
  199. }
  200. }
  201. .center{
  202. margin-bottom: 10rpx;
  203. font-size: 30rpx;
  204. color: #333;
  205. line-height: 50rpx;
  206. font-weight: 600;
  207. }
  208. .bottom{
  209. font-size: 30rpx;
  210. color: #666;
  211. }
  212. }
  213. .order-reduced{
  214. .reduced-item{
  215. padding-bottom: 30rpx;
  216. &:not(:last-child){
  217. margin-bottom: 30rpx;
  218. }
  219. .label{
  220. border-radius: 2px;
  221. border: 1px solid #FF3C3F;
  222. margin-left: 20rpx;
  223. font-size: 20rpx;
  224. color: #FF3C3F;
  225. padding: 0 10rpx;
  226. }
  227. }
  228. .integral{
  229. .num{
  230. font-size: 30rpx;
  231. color: #02AB35;
  232. font-weight: 600;
  233. margin-left: 30rpx;
  234. margin-right: 16rpx;
  235. }
  236. .tip{
  237. font-size: 24rpx;
  238. color: #999;
  239. }
  240. .price{
  241. margin-right: 10rpx;
  242. }
  243. }
  244. }
  245. .total{
  246. .total-item{
  247. padding-bottom: 30rpx;
  248. &:not(:last-child){
  249. margin-bottom: 30rpx;
  250. }
  251. .right{
  252. font-weight: 600;
  253. }
  254. }
  255. .gray{
  256. font-size: 24rpx;
  257. margin-left: 15rpx;
  258. }
  259. }
  260. .cart-bottom{
  261. height: 98rpx;
  262. .inner{
  263. position: fixed;
  264. background-color: #fff;
  265. height: 98rpx;
  266. left: 0;
  267. right: 0;
  268. bottom: 0;
  269. padding: 0 20rpx;
  270. .total-price{
  271. font-size: 30rpx;
  272. color: #333;
  273. font-weight: 600;
  274. margin-left: 30rpx;
  275. }
  276. .btn{
  277. font-size: 26rpx;
  278. height: 64rpx;
  279. line-height: 64rpx;
  280. border-radius: 50rpx;
  281. padding: 0 40rpx;
  282. border: 1px solid #333;
  283. color: #333;
  284. text-align: center;
  285. background-color: transparent;
  286. margin-left: 10rpx;
  287. &.red{
  288. border-color: #FF3C3F;
  289. background-color: #FF3C3F;
  290. color: #fff;
  291. }
  292. }
  293. }
  294. }
  295. .product{
  296. .text{
  297. .name{
  298. height: auto;
  299. }
  300. .info{
  301. font-size: 24rpx;
  302. font-weight: 400;
  303. color: #666666;
  304. }
  305. }
  306. }
  307. </style>