index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view>
  3. <view class="address" v-if="order.delivery">
  4. <view class="icon">
  5. <text class="cell-icon yticon icon-dizhi" style="color: #ffffff"></text>
  6. </view>
  7. <view class="info">
  8. <view class="name">{{order.delivery.username}}<text class="mobile">{{order.delivery.mobile}}</text></view>
  9. <view class="address">{{order.delivery.address}}</view>
  10. </view>
  11. </view>
  12. <view class="product" v-if="order.products">
  13. <view class="goods-box-single" v-for="(goodsItem, goodsIndex) in order.products" :key="goodsIndex" @click="navTo('/pages/product/product?id='+goodsItem.id+'&flash=0')">
  14. <image class="goods-img" :src="goodsItem.image" mode="aspectFill"></image>
  15. <view class="right">
  16. <text class="title clamp">{{goodsItem.title}}</text>
  17. <text class="attr-box">{{goodsItem.spec}} x {{goodsItem.number}}</text>
  18. <text class="price">{{goodsItem.price}}</text>
  19. <button class="action-btn" v-if="order.have_received != 0 && goodsItem.evaluate == false" @click.stop="button('evaluate', goodsItem)">评价</button>
  20. </view>
  21. </view>
  22. <view class="price">
  23. <view>商品总价 <text>¥ {{order.order_price}}</text></view>
  24. <view>运费 <text>¥ {{order.delivery_price}}</text></view>
  25. <view>优惠 <text>¥ {{order.discount_price}}</text></view>
  26. <view class="total">实付款(含运费) <text>¥ {{order.total_price}}</text></view>
  27. </view>
  28. </view>
  29. <view class="order" v-if="order.createtime">
  30. <view class="title">订单信息</view>
  31. <view>订单编号:{{order.out_trade_no}}</view>
  32. <view>创建时间:{{order.createtime}}</view>
  33. <view>付款时间:{{order.have_paid ? order.paidtime : '未付款'}}</view>
  34. <view>发货时间:{{order.have_delivered ? order.deliveredtime : '未发货'}}</view>
  35. <view v-if="order.have_received">成交时间:{{order.receivedtime}}</view>
  36. <view v-if="order.have_refunded">退货时间:{{order.refundedtime}}</view>
  37. </view>
  38. <view style="height: 10rpx;">
  39. <!--兼容苹果系统下margin-bottom不生效-->
  40. </view>
  41. <view class="bottom" v-if="order.state != 9">
  42. <button class="action-btn" v-if="order.have_paid != 0 && order.have_received == 0" @click.stop="recerved()">确认核销该订单</button>
  43. <span class="success" v-else>已经核销成功</span>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. // pages/tabbar/index/index.js
  49. import {
  50. mapMutations,
  51. } from 'vuex';
  52. var app = getApp();
  53. export default {
  54. data() {
  55. return {
  56. uid: "",
  57. order_id: "",
  58. token: "",
  59. order: {}
  60. };
  61. },
  62. onLoad: function(options) {
  63. this.uid = options.uid;
  64. this.order_id = options.order_id;
  65. this.token = options.token;
  66. //this.puid = options.puid||'';
  67. this.bind();
  68. },
  69. onShareAppMessage: function() {},
  70. methods: {
  71. ...mapMutations(['login']),
  72. async bind() {
  73. let [error, loginRes] = await uni.login({
  74. provider: 'weixin'
  75. });
  76. let res = await this.$api.request('/order/detail', 'GET', {
  77. order_id: this.order_id
  78. });
  79. this.order = res;
  80. },
  81. async recerved() {
  82. let res = await this.$api.request('/order/writeOffIpl', 'POST', {
  83. order_id: this.order_id,
  84. user_id: this.uid,
  85. token: this.token
  86. });
  87. this.bind();
  88. }
  89. }
  90. };
  91. </script>
  92. <style>
  93. page {
  94. background: #F5F5F5;
  95. padding: 20rpx;
  96. box-sizing: border-box;
  97. }
  98. </style>
  99. <style lang="scss">
  100. .header {
  101. height: 200rpx;
  102. background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C);
  103. .left {
  104. color: #ffffff;
  105. line-height: 200rpx;
  106. padding-left: 100rpx;
  107. }
  108. }
  109. .delivery {
  110. color: #545454;
  111. background: #ffffff;
  112. border-bottom: 1px solid #e9e9e9;
  113. .icon {
  114. background: #00a7c8;
  115. height: 60rpx;
  116. width: 60rpx;
  117. display: inline-block;
  118. border-radius: 100rpx;
  119. margin: 50rpx 30rpx;
  120. text-align: center;
  121. line-height: 60rpx;
  122. }
  123. .info {
  124. display: inline-flex;
  125. flex-direction: column;
  126. justify-content: center;
  127. width: 600rpx;
  128. vertical-align: middle;
  129. margin: 30rpx 0;
  130. position: relative;
  131. .right {
  132. position: absolute;
  133. right: 0;
  134. }
  135. }
  136. }
  137. .address {
  138. color: #545454;
  139. background: #ffffff;
  140. .icon {
  141. background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C);
  142. height: 60rpx;
  143. width: 60rpx;
  144. display: inline-block;
  145. border-radius: 100rpx;
  146. margin: 50rpx 30rpx;
  147. text-align: center;
  148. line-height: 60rpx;
  149. }
  150. .info {
  151. display: inline-flex;
  152. flex-direction: column;
  153. justify-content: center;
  154. width: 600rpx;
  155. vertical-align: middle;
  156. margin: 30rpx 0;
  157. .mobile {
  158. color: #9b9b9b;
  159. margin-left: 30rpx;
  160. }
  161. }
  162. }
  163. .product {
  164. background: #ffffff;
  165. margin-top: 20rpx;
  166. padding: 30rpx;
  167. line-height: 60rpx;
  168. /* 单条商品 */
  169. .goods-box-single {
  170. display: flex;
  171. padding: 20upx 0;
  172. border-bottom: 1rpx solid #eaeaea;
  173. .goods-img {
  174. display: block;
  175. width: 120upx;
  176. height: 120upx;
  177. }
  178. .right {
  179. flex: 1;
  180. display: flex;
  181. flex-direction: column;
  182. padding: 0 30upx 0 24upx;
  183. overflow: hidden;
  184. position: relative;
  185. .title {
  186. font-size: $font-base + 2upx;
  187. color: $font-color-dark;
  188. line-height: 1;
  189. }
  190. .attr-box {
  191. font-size: $font-sm + 2upx;
  192. color: $font-color-light;
  193. padding: 10upx 12upx;
  194. }
  195. .price {
  196. font-size: $font-base + 2upx;
  197. color: $font-color-dark;
  198. margin-top: 0;
  199. &:before {
  200. content: '¥';
  201. font-size: $font-sm;
  202. margin: 0 2upx 0 8upx;
  203. }
  204. }
  205. .action-btn {
  206. width: 160rpx;
  207. height: 60rpx;
  208. padding: 0;
  209. text-align: center;
  210. line-height: 60rpx;
  211. font-size: 26rpx;
  212. color: #303133;
  213. background: #fff;
  214. border-radius: 100px;
  215. float: right;
  216. position: absolute;
  217. right: 0;
  218. bottom: 0;
  219. }
  220. }
  221. }
  222. .price {
  223. color: #9b9b9b;
  224. font-size: 26rpx;
  225. margin-top: 30rpx;
  226. text {
  227. float: right;
  228. }
  229. .total {
  230. font-size: 35rpx;
  231. text {
  232. color: #F56C6C;
  233. }
  234. }
  235. }
  236. }
  237. .order {
  238. background: #ffffff;
  239. margin-top: 20rpx;
  240. padding: 30rpx;
  241. .title {
  242. border-left: 4rpx solid #F56C6C;
  243. padding-left: 17rpx;
  244. color: #898989;
  245. font-size: 35rpx;
  246. margin-bottom: 20rpx;
  247. }
  248. font-size: 26rpx;
  249. color: #9b9b9b;
  250. line-height: 60rpx;
  251. margin-bottom: 120rpx;
  252. }
  253. .bottom {
  254. position: fixed;
  255. width: 100%;
  256. height: 100rpx;
  257. background: #ffffff;
  258. bottom: 0;
  259. border-top: 1px solid #e9e9e9;
  260. .action-btn {
  261. width: 280rpx;
  262. height: 60rpx;
  263. margin: 20rpx 50rpx 20rpx 20rpx;
  264. padding: 0;
  265. text-align: center;
  266. line-height: 60rpx;
  267. font-size: 26rpx;
  268. color: #303133;
  269. background: #fff;
  270. border-radius: 100px;
  271. float: right;
  272. &:after {
  273. border-radius: 100px;
  274. }
  275. &.recom {
  276. background: #fff9f9;
  277. color: $base-color;
  278. &:after {
  279. border-color: #f7bcc8;
  280. }
  281. }
  282. }
  283. .success {
  284. float: right;
  285. width: 8em;
  286. line-height: 2.4em;
  287. }
  288. }
  289. </style>