order.vue 7.4 KB

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