1
0

app-order.vue 13 KB

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