order.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view>
  3. <view class=""></view>
  4. <view class="content">
  5. <!-- <up-modal :show="show" title="555" ></up-modal>
  6. -->
  7. <u-tabs class="tabs" itemStyle="width:33%;height:100rpx;" :list="tabList" @click="tabsClick"
  8. lineColor="#FF5C03"></u-tabs>
  9. <view class="order-list">
  10. <view class="order-item" v-for="(item,index) in orderList" :key="index">
  11. <view class="order-num">
  12. <text>订单号:{{item.orderCode}}</text>
  13. <text v-if="item.status==-1">申请退款</text>
  14. <text v-else-if="item.status==-2">退货成功</text>
  15. <text v-else-if="item.status==1">待支付</text>
  16. <text v-else-if="item.status==2">待发货</text>
  17. <text v-else-if="item.status==3">待收货</text>
  18. <!-- <text v-else-if="item.status==4">待评价</text> -->
  19. <text v-else-if="item.status==5">已完成</text>
  20. <text v-else-if="item.status==-3">已取消</text>
  21. </view>
  22. <view class="order-main" v-for="(itm,idx) in item.orderItemList" :key="idx">
  23. <view class="img-box">
  24. <image :src="itm.imgUrl"></image>
  25. </view>
  26. <view class="order-text">
  27. <view class="title">{{itm.productName}}</view>
  28. <view class="txt">适用于乏力、头晕等人群,通过问诊可明确诊断给予专业性指导意见。</view>
  29. <view class="num">
  30. <text>{{itm.sales}} 人已购</text>
  31. <text class="grey">x{{itm.num}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="order-bottom">
  36. <view class="order-money">
  37. <text class="title">订单金额:</text>
  38. <text class="num">¥<text class="bold">{{item.totalPrice}}</text>.00</text>
  39. </view>
  40. <view class="button-group">
  41. <view v-if="item.status == 1" @click="cancel(item)" class="button cancel ">取消订单</view>
  42. <view v-if="item.status !== -1 && item.status !== -3" @click="refund(item)"
  43. class="button cancel">申请售后</view>
  44. <view v-if="item.status ==3 ||item.status ==5 " class="button cancel"
  45. @click.stop="showDelivery(item)">查看物流</view>
  46. <view v-if="item.status == 1" @click="pay(item)" class="button pay">去支付</view>
  47. <!-- <view v-if="item.status == 2" @click="urgeShipment(item)" class="button cancel">催发货</view> -->
  48. <view v-if="item.status == 3" @click="confirmReceipt(item)" class="button pay">确认收货</view>
  49. <view v-if="item.status == 4" @click="evaluate(item)" class="button pay">评价</view>
  50. <!-- <view class="button">查看物流</view> -->
  51. <!-- <view v-if="item.status == 1" class="button pay">去支付</view>
  52. <view v-if="item.status == 1" class="button pay">去支付</view> -->
  53. </view>
  54. <!-- <view class="button">申请售后</view>
  55. <view class="button">查看物流</view> -->
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. cancelOrder, //取消订单
  65. liveOrderList, // 订单列表
  66. finishOrder //确认收货
  67. } from '@/api/order.js'
  68. export default {
  69. data() {
  70. return {
  71. status: '',
  72. orderList: [],
  73. tabList: [{
  74. name: "全部",
  75. status: ""
  76. },
  77. {
  78. name: "待支付",
  79. status: "1"
  80. },
  81. {
  82. name: "待发货",
  83. status: "2"
  84. },
  85. {
  86. name: "待收货",
  87. status: "3"
  88. },
  89. // {
  90. // name: "待评价",
  91. // status: "4"
  92. // },
  93. {
  94. name: "已完成",
  95. status: "5"
  96. }
  97. ]
  98. }
  99. },
  100. mounted() {
  101. this.getliveOrderList(this.status)
  102. },
  103. methods: {
  104. // 确认收货
  105. confirmReceipt(item) {
  106. var that = this;
  107. uni.showModal({
  108. title: '提示',
  109. content: '确认收到货了吗',
  110. success: function(res) {
  111. if (res.confirm) {
  112. var data = {
  113. orderId: item.orderId,
  114. };
  115. finishOrder(data).then(res => {
  116. if (res.code == 200) {
  117. uni.showToast({
  118. icon: 'success',
  119. title: "操作成功",
  120. });
  121. that.getliveOrderList(that.status)
  122. } else {
  123. uni.showToast({
  124. icon: 'none',
  125. title: res.msg,
  126. });
  127. }
  128. });
  129. } else if (res.cancel) {
  130. }
  131. }
  132. });
  133. },
  134. // 取消订单
  135. cancel(item) {
  136. var that = this;
  137. uni.showModal({
  138. title: '提示',
  139. content: '确定取消订单吗',
  140. success: function(res) {
  141. if (res.confirm) {
  142. var data = {
  143. orderId: item.orderId,
  144. };
  145. cancelOrder(data).then(res => {
  146. if (res.code == 200) {
  147. uni.showToast({
  148. icon: 'success',
  149. title: "操作成功",
  150. });
  151. that.getliveOrderList(that.status)
  152. } else {
  153. uni.showToast({
  154. icon: 'none',
  155. title: res.msg,
  156. });
  157. }
  158. });
  159. } else if (res.cancel) {
  160. }
  161. }
  162. });
  163. },
  164. // 申请售后
  165. refund(item) {
  166. uni.navigateTo({
  167. url: './refundOrderProduct?orderId=' + item.orderId
  168. })
  169. },
  170. // tab切换
  171. tabsClick(item) {
  172. this.getliveOrderList(item.status) // 切换时重新获取数据
  173. this.status = item.status
  174. },
  175. // 订单列表
  176. getliveOrderList(status) {
  177. let data = {
  178. pageSize: 10,
  179. page: 1,
  180. status: status // 添加状态参数
  181. }
  182. liveOrderList(data).then(res => {
  183. if (res.code == 200) {
  184. console.log("订单列表数据>>>>", res)
  185. this.orderList = res.rows
  186. } else {
  187. uni.showToast({
  188. title: res.msg,
  189. icon: 'none'
  190. });
  191. }
  192. },
  193. rej => {
  194. console.log("rej:" + JSON.stringify(rej));
  195. }
  196. );
  197. },// 查看物流
  198. showDelivery(item) {
  199. uni.navigateTo({
  200. url: './storeOrderDelivery?orderId='+item.orderId
  201. })
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. :deep(.u-tabs) {
  208. background-color: #FFFFFF;
  209. }
  210. :deep(.u-tabs__wrapper__nav) {
  211. width: 100%;
  212. }
  213. .content {
  214. .order-list {
  215. background: #F5F7FA;
  216. padding: 0 24rpx;
  217. .order-item {
  218. background: #FFFFFF;
  219. border-radius: 16rpx;
  220. padding: 30rpx 24rpx;
  221. margin-top: 24rpx;
  222. .order-num {
  223. display: flex;
  224. justify-content: space-between;
  225. font-size: 26rpx;
  226. color: #999999;
  227. }
  228. .order-main {
  229. display: flex;
  230. margin: 26rpx 0 30rpx;
  231. .img-box {
  232. width: 180rpx;
  233. height: 180rpx;
  234. border-radius: 16rpx;
  235. flex-shrink: 0;
  236. overflow: hidden;
  237. margin-right: 26rpx;
  238. image {
  239. width: 100%;
  240. height: 100%;
  241. }
  242. }
  243. .order-text {
  244. .title {
  245. font-weight: 500;
  246. font-size: 28rpx;
  247. color: #222222;
  248. }
  249. .txt {
  250. font-size: 24rpx;
  251. color: #999999;
  252. margin: 8rpx 0 18rpx 0;
  253. }
  254. .num {
  255. display: flex;
  256. justify-content: space-between;
  257. font-size: 22rpx;
  258. color: #E69A22;
  259. .grey {
  260. margin-top: 12rpx;
  261. font-size: 24rpx;
  262. color: #999999;
  263. }
  264. }
  265. }
  266. }
  267. .order-bottom {
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: center;
  271. .order-money {
  272. .title {
  273. font-size: 24rpx;
  274. color: #757575;
  275. }
  276. .num {
  277. font-weight: 600;
  278. font-size: 20rpx;
  279. color: #FF5C03;
  280. .bold {
  281. font-weight: bold;
  282. font-size: 36rpx;
  283. }
  284. }
  285. }
  286. .button-group {
  287. display: flex;
  288. align-items: center;
  289. .button {
  290. margin-left: 10rpx;
  291. padding: 10rpx 14rpx;
  292. border-radius: 8rpx;
  293. font-weight: 500;
  294. font-size: 24rpx;
  295. }
  296. .cancel {
  297. background-color: #ececec;
  298. color: #2c2c2c;
  299. }
  300. .pay {
  301. color: #FFFFFF;
  302. background: linear-gradient(270deg, #FF5C03 0%, #FFAC64 100%);
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>