app-order.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <view>
  3. <view @click="toDetail(item.id)" class="item">
  4. <view class="title main-between cross-center">
  5. <view class="activity-title dir-left-nowrap">
  6. <image src="./../image/activity-name.png"></image>
  7. <view>{{item.title}}</view>
  8. </view>
  9. <view class="number dir-right-nowrap">
  10. <view :class="theme + '-m-text ' + theme">{{item.no}}</view>
  11. <view v-if="is_user && item.cancel_status == 1" class="status">已关闭</view>
  12. <view v-else-if="is_user && item.is_sale == 1" class="status">已完成</view>
  13. <view v-else-if="is_user && item.is_confirm == 1" class="status">已提货</view>
  14. <view v-else-if="is_user && item.is_send == 1" class="status">待提货</view>
  15. <view v-else-if="is_user && item.is_pay == 1" class="status">待发货</view>
  16. <view v-else-if="is_user && item.is_pay == 0" class="status">未付款</view>
  17. </view>
  18. </view>
  19. <view v-if="!is_user" class="info main-between cross-center">
  20. <view class="user-info dir-left-nowrap cross-center">
  21. <view class="avatar">
  22. <image :src="item.user_avatar"></image>
  23. </view>
  24. <view class="user">
  25. {{item.name}}
  26. <text>{{item.mobile}}</text>
  27. </view>
  28. </view>
  29. <view :class="theme + '-m-text ' + theme" v-if="item.cancel_status == 1" class="status">已关闭</view>
  30. <view :class="theme + '-m-text ' + theme" v-else-if="item.is_sale == 1" class="status">已完成</view>
  31. <view :class="theme + '-m-text ' + theme" v-else-if="item.is_confirm == 1" class="status">已提货</view>
  32. <view :class="theme + '-m-text ' + theme" v-else-if="item.is_send == 1" class="status">待提货</view>
  33. <view :class="theme + '-m-text ' + theme" v-else-if="item.is_pay == 1" class="status">待发货</view>
  34. <view :class="theme + '-m-text ' + theme" v-else-if="item.is_pay == 0" class="status">未付款</view>
  35. </view>
  36. <view v-if="item.remark" class="remark">买家备注:{{item.remark}}</view>
  37. <view v-for="goods in item.detail" class="goods" :key="goods.id">
  38. <image class="goods-img" mode='aspectFill' :src='goods.goods_info.pic_url'></image>
  39. <view class='t-omit-two goods-name'>{{goods.goods_info.name}}</view>
  40. <view class="goods-attr t-omit">
  41. <text v-for="attr in goods.goods_info.attr_list"
  42. :key="item.attr_id">{{attr.attr_group_name}}:{{attr.attr_name}}</text>
  43. </view>
  44. <view class="goods-num">x{{goods.goods_info.num}}</view>
  45. <view class="goods-price">¥{{goods.goods_info.total_original_price}}</view>
  46. <view class="" style="display: flex; align-items: center;justify-content: space-between;">
  47. <view class="goods-num" style="position: static;">
  48. 碎屏险 x1
  49. </view>
  50. <view class="goods-price" style="position: static;">
  51. ¥{{goods.service_price}}
  52. </view>
  53. </view>
  54. </view>
  55. <view class="order-total">共<text>{{item.num}}</text>件商品 合计<text>¥{{item.total_price}}</text></view>
  56. <view class="dir-right-nowrap">
  57. <view @click.stop="orderPay(item)" v-if="is_user && item.is_pay == 0 && item.cancel_status == 0"
  58. class="pick-btn" :class="theme + '-m-text ' + theme + ' ' +theme + '-m-border ' + theme">立即支付</view>
  59. <view @click.stop="toRemind(item)" v-if="item.is_send == 1 && item.is_confirm == 0" class="pick-btn"
  60. :class="theme + '-m-text ' + theme + ' ' +theme + '-m-border ' + theme">确认提货</view>
  61. </view>
  62. </view>
  63. <view v-if="show" class="bg">
  64. <view class="dialog">
  65. <view class="dialog-content">是否确认提货</view>
  66. <view class="main-center btn-area">
  67. <view class="submit-btn box-grow-1" style="color: #666" @click='toRemind'>取消</view>
  68. <view class="line"></view>
  69. <view class="submit-btn box-grow-1" @click='beConfirm' :class="theme + '-m-text ' + theme">确认</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. mapState
  78. } from "vuex";
  79. export default {
  80. name: 'app-order',
  81. props: {
  82. item: {
  83. type: Object
  84. },
  85. is_user: {
  86. type: Boolean
  87. },
  88. is_confirm: {
  89. type: Boolean
  90. },
  91. theme: String
  92. },
  93. data() {
  94. return {
  95. show: false,
  96. orderList: [],
  97. id: 0,
  98. };
  99. },
  100. methods: {
  101. toRemind(item) {
  102. if (item.id > 0) {
  103. this.show = true;
  104. this.id = item.id
  105. } else {
  106. this.show = false;
  107. this.id = 0;
  108. }
  109. },
  110. // 订单支付
  111. orderPay(e) {
  112. let _this = this;
  113. _this.$showLoading();
  114. _this.$request({
  115. url: _this.$api.order.list_pay_data,
  116. data: {
  117. id: e.id
  118. }
  119. }).then(response => {
  120. _this.$hideLoading();
  121. if (response.code === 0) {
  122. _this.$payment.pay(response.data.id).then(() => {
  123. // 支付成功
  124. uni.redirectTo({
  125. url: '/plugins/community/order/order?is_user=1'
  126. })
  127. }).catch(e => {
  128. // 支付失败
  129. uni.showModal({
  130. title: '',
  131. content: e.errMsg,
  132. showCancel: false
  133. })
  134. })
  135. }
  136. }).catch(() => {
  137. _this.$hideLoading();
  138. });
  139. },
  140. toDetail(id) {
  141. let is_user = 0;
  142. if (this.is_user) {
  143. is_user = 1
  144. }
  145. uni.navigateTo({
  146. url: '/plugins/community/order-detail/order-detail?id=' + id + '&is_user=' + is_user
  147. });
  148. },
  149. beConfirm() {
  150. let that = this;
  151. that.show = false;
  152. uni.showLoading({
  153. title: '确认提货中...'
  154. });
  155. that.$request({
  156. url: that.is_user ? that.$api.order.confirm : that.$api.community.confirm,
  157. data: {
  158. id: that.id
  159. }
  160. }).then(response => {
  161. uni.hideLoading();
  162. if (response.code == 0) {
  163. that.item.is_confirm = 1;
  164. that.id = 0;
  165. that.$emit('update', that.item);
  166. } else {
  167. uni.showToast({
  168. title: response.msg,
  169. icon: 'none',
  170. duration: 1000
  171. });
  172. }
  173. })
  174. }
  175. }
  176. }
  177. </script>
  178. <style scoped lang="scss">
  179. .item {
  180. border-radius: 16rpx;
  181. background-color: #fff;
  182. width: 702rpx;
  183. margin: 24rpx;
  184. margin-top: 0;
  185. padding: 24rpx;
  186. &:first-of-type {
  187. margin-top: 24rpx;
  188. }
  189. .status {
  190. font-size: 24rpx;
  191. }
  192. .title {
  193. height: 32rpx;
  194. line-height: 32rpx;
  195. margin-bottom: 24rpx;
  196. .number {
  197. font-size: 38rpx;
  198. .status {
  199. margin-right: 30rpx;
  200. }
  201. }
  202. .activity-title {
  203. color: #353535;
  204. font-size: #{24rpx};
  205. height: 30rpx;
  206. line-height: 30rpx;
  207. image {
  208. width: 30rpx;
  209. height: 30rpx;
  210. margin-right: 20rpx;
  211. display: block;
  212. }
  213. }
  214. }
  215. .info {
  216. height: 56rpx;
  217. font-size: 24rpx;
  218. .user-info {
  219. height: 56rpx;
  220. .avatar {
  221. margin-right: 20rpx;
  222. width: 56rpx;
  223. height: 56rpx;
  224. border-radius: 50%;
  225. image {
  226. width: 56rpx;
  227. height: 56rpx;
  228. border-radius: 50%;
  229. }
  230. }
  231. .user {
  232. color: #353535;
  233. text {
  234. margin-left: 30rpx;
  235. }
  236. }
  237. }
  238. }
  239. .remark {
  240. margin-top: 25rpx;
  241. word-break: break-all;
  242. font-size: 24rpx;
  243. color: #3b3939;
  244. padding: 20rpx 24rpx;
  245. background-color: #F7F7F7;
  246. }
  247. .goods {
  248. height: #{160rpx};
  249. margin-top: #{24rpx};
  250. position: relative;
  251. font-size: #{24rpx};
  252. color: #353535;
  253. margin-bottom: #{24rpx};
  254. .goods-img {
  255. height: #{160rpx};
  256. width: #{160rpx};
  257. float: left;
  258. margin-right: #{20rpx};
  259. border-radius: #{4rpx};
  260. }
  261. .goods-attr {
  262. font-size: #{24rpx};
  263. color: #999;
  264. width: 70%;
  265. position: absolute;
  266. width: 70%;
  267. top: #{78rpx};
  268. left: #{180rpx};
  269. text {
  270. margin-right: #{20rpx};
  271. }
  272. }
  273. .goods-num {
  274. font-size: #{24rpx};
  275. color: #999;
  276. position: absolute;
  277. top: #{126rpx};
  278. left: #{180rpx};
  279. }
  280. .goods-price {
  281. font-size: #{24rpx};
  282. color: #353535;
  283. position: absolute;
  284. bottom: 0;
  285. right: 0;
  286. }
  287. }
  288. .order-total {
  289. text-align: right;
  290. color: #999999;
  291. font-size: 24rpx;
  292. margin-bottom: 24rpx;
  293. text {
  294. font-size: 28rpx;
  295. color: #353535;
  296. }
  297. }
  298. .pick-btn {
  299. height: 48rpx;
  300. line-height: 46rpx;
  301. border-radius: 24rpx;
  302. border: 2rpx solid;
  303. font-size: 24rpx;
  304. display: inline-block;
  305. padding: 0 20rpx;
  306. margin-left: 20rpx;
  307. }
  308. }
  309. .bg {
  310. position: fixed;
  311. background-color: rgba(0, 0, 0, .3);
  312. top: 0;
  313. left: 0;
  314. height: 100%;
  315. width: 100%;
  316. z-index: 99;
  317. .dialog {
  318. width: 480rpx;
  319. height: 200rpx;
  320. position: fixed;
  321. top: 30%;
  322. left: 50%;
  323. margin-left: -240rpx;
  324. background-color: #fff;
  325. border-radius: 16rpx;
  326. z-index: 233;
  327. font-size: 28rpx;
  328. color: #353535;
  329. .dialog-content {
  330. height: 110rpx;
  331. line-height: 110rpx;
  332. text-align: center;
  333. }
  334. .btn-area {
  335. height: #{88rpx};
  336. position: relative;
  337. border-top: #{2rpx} solid #e2e2e2;
  338. .line {
  339. height: #{32rpx};
  340. width: #{1rpx};
  341. background-color: #e2e2e2;
  342. position: absolute;
  343. top: #{28rpx};
  344. left: 0;
  345. right: 0;
  346. margin: 0 auto;
  347. }
  348. .submit-btn {
  349. height: #{88rpx};
  350. line-height: #{88rpx};
  351. font-size: #{28rpx};
  352. text-align: center;
  353. }
  354. }
  355. }
  356. }
  357. </style>