orderlist.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <div class="orders">
  3. <div class="tabs flex_r flex_jse">
  4. <div v-for="(i,s) in tabs" :key="s" :class="{active:activeKey==i.key}" @click="ontab(i.key)">{{i.text}}</div>
  5. </div>
  6. <template v-if="activeKey == 1">
  7. <div class="orderlist" v-if="orderList.length">
  8. <div class="o_item" v-for="(i,s) in orderList" :key="s" @click="entrance(i)">
  9. <div class="p1 flex_r flex_jb">
  10. <span class="name_tit ellipsis">{{ i.restaurant_name }}</span>
  11. <span class="status">{{ typeto(i.status) }}</span>
  12. </div>
  13. <div class="p2 flex_r flex_jb" v-if="i.type == 0">
  14. <div class="goods ellipsis">
  15. <div class="imgs" v-for="(a,b) in i.orderGoods" :key="b">
  16. <img :src="a.product_img" alt="" class="g_img">
  17. <div class="na ellipsis">{{ a.product_name }}</div>
  18. </div>
  19. </div>
  20. <div class="g_amount"><span class="amount dinB">{{ i.actually_paid || i.pay_amount }}</span></div>
  21. </div>
  22. <div class="p2 flex_r flex_jb" v-else-if="i.type == 1">
  23. <div class="Movie flex_r flex_jb" v-for="(a,b) in i.orderGoods" :key="b">
  24. <div class="info flex_c flex_jb">
  25. <p class="pt">{{ a.product_name }}</p>
  26. <p class="p">{{ a.number }}张</p>
  27. <p class="p">实付 ¥{{ i.actually_paid || i.pay_amount }}</p>
  28. <p class="p">{{ neaten1(i.product_detail,i.type) }}</p>
  29. </div>
  30. <image class="poster" mode="aspectFill" :src="a.product_img" />
  31. </div>
  32. </div>
  33. <div class="p2 flex_r flex_jb" v-else-if="[2,3,6].includes(i.type)">
  34. <div class="goods good2 ellipsis">
  35. <div class="p" v-for="(a,b) in i.orderGoods" :key="b">{{ a.product_name }}</div>
  36. </div>
  37. <div class="g_amount"><span class="amount dinB">{{ i.actually_paid || i.pay_amount }}</span></div>
  38. </div>
  39. <div class="p2 flex_r flex_jb" v-else-if="i.type == 4">
  40. <div class="Movie flex_r flex_jb" v-for="(a,b) in i.orderGoods" :key="b">
  41. <div class="info flex_c flex_jb">
  42. <p class="pt">{{ a.product_name }}</p>
  43. <p class="p">{{ a.number }}间</p>
  44. <p class="p">实付 ¥{{ i.actually_paid || i.pay_amount }}</p>
  45. <p class="p" v-if="a.attachment">{{ neaten2(a.attachment,i.type) }}</p>
  46. </div>
  47. <image class="poster" mode="aspectFill" :src="a.product_img" />
  48. </div>
  49. </div>
  50. <div class="p2 flex_r flex_jb" v-else-if="i.type == 5">
  51. <div class="Movie flex_r flex_jb" v-for="(a,b) in i.orderGoods" :key="b">
  52. <image class="poster" mode="aspectFill" :src="a.product_img" />
  53. <div class="info flex_c flex_jb">
  54. <p class="pt">{{ a.product_name }}</p>
  55. <p class="p">{{ a.number }}张</p>
  56. <p class="p">实付 ¥{{ i.actually_paid || i.pay_amount }}</p>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="p3">下单时间:{{ i.create_time }}</div>
  61. </div>
  62. </div>
  63. <div class="zanwu" v-else>
  64. <img src="http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/5a3c6b1e2d098aa6695394c927c38586545188b8png" alt="" class="zanwuimg">
  65. <view class="zanwutxt">暂无订单信息</view>
  66. </div>
  67. </template>
  68. <template v-if="activeKey == 2">
  69. <div class="orderlist" v-if="selfSupportList.length">
  70. <div class="o_item" v-for="(i,s) in selfSupportList" :key="s" @click="entrance(i)">
  71. <div class="p1 flex_r flex_jb">
  72. <span class="name_tit ellipsis">{{ i.name }}</span>
  73. </div>
  74. <div class="p2 flex_r flex_jb">
  75. <div class="goods good2 ">金额</div>
  76. <div class="g_amount"><span class="amount dinB">{{ i.order_amount }}</span></div>
  77. </div>
  78. <div class="p3">订单编号:{{ i.order_no }}</div>
  79. <div class="p3 mt-10">下单时间:{{ i.create_time }}</div>
  80. </div>
  81. </div>
  82. <div class="zanwu" v-else>
  83. <img src="http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/5a3c6b1e2d098aa6695394c927c38586545188b8png" alt="" class="zanwuimg">
  84. <view class="zanwutxt">暂无订单信息</view>
  85. </div>
  86. </template>
  87. </div>
  88. </template>
  89. <script>
  90. import { post } from "@/request/api.js";
  91. export default {
  92. name: "orderlist",
  93. props: {},
  94. components: {},
  95. data() {
  96. return {
  97. orderList: [],
  98. tabs: [
  99. { key: 1, text: "我的订单" },
  100. { key: 2, text: "快捷买单" },
  101. ],
  102. activeKey: 1,
  103. Query: {
  104. page: 1,
  105. rows: 20,
  106. },
  107. pageData: {},
  108. selfSupportList: [],
  109. };
  110. },
  111. methods: {
  112. getorderList() {
  113. post("local/orderList").then(res => {
  114. if (res.code == 0) {
  115. this.orderList = res.data
  116. }
  117. })
  118. },
  119. typeto(va) {
  120. switch (va) {
  121. case 0:
  122. return "待支付";
  123. case 1:
  124. return "已下单";
  125. case 2:
  126. return "已完成";
  127. case 3:
  128. return "下单失败";
  129. case 4:
  130. return "失败";
  131. default:
  132. return ""
  133. }
  134. },
  135. entrance(i) {
  136. if (i.type == 0) this.goto('/pagesB/orderingfood/detail', { trade_no: i.trade_no, brand_id: i.brand_id })
  137. else if (i.type == 1) this.goto('/pagesB/cinema/cinemaTicket', { tradeNo: i.trade_no })
  138. else if ([2, 3].includes(i.type)) this.goto('/pagesB/directCharge/orderDetail', { trade_no: i.trade_no })
  139. else if (i.type == 4) this.goto('/pagesB/hotel/orderDetail', { trade_no: i.trade_no })
  140. else if (i.type == 5) this.goto('/pagesB/scenicSpotTicket/orderDetail', { trade_no: i.trade_no })
  141. else if (i.type == 6) this.goto('/pagesB/prepaidRefill/orderDetail', { trade_no: i.trade_no })
  142. },
  143. neaten1(va, type) {
  144. if (va && type == 1) {
  145. let arr = JSON.parse(va)
  146. return arr.map(item => item.seatName).join(",")
  147. }
  148. },
  149. neaten2(va, type) {
  150. if (type == 4) {
  151. let da = JSON.parse(va)
  152. return `${da.windowType},${da.breakfast},${da.bedType},${da.useableArea}`
  153. }
  154. },
  155. ontab(va) {
  156. // uni.showLoading({title: '加载中'})
  157. this.activeKey = va
  158. },
  159. getList(page) {
  160. if (page) {
  161. this.list = []
  162. this.Query.page = 1
  163. }
  164. post("v1/merchant/ordersList", this.Query).then(res => {
  165. if (res.code == 0) {
  166. let da = res.data.data
  167. delete res.data.data
  168. this.pageData = res.data
  169. this.selfSupportList = [...this.selfSupportList, ...da]
  170. this.Query.page++
  171. uni.hideLoading()
  172. }
  173. })
  174. },
  175. },
  176. onLoad(da) {
  177. this.getorderList()
  178. this.getList()
  179. },
  180. onShow() {},
  181. mounted() {},
  182. computed: {
  183. isShow1() {
  184. return this.orderList.length && this.activeKey == 1
  185. },
  186. isShow2() {
  187. return this.selfSupportList.length && this.activeKey == 2
  188. },
  189. },
  190. onReachBottom() {
  191. if (this.Query.page < this.pageData.last_page) this.getList();
  192. },
  193. };
  194. </script>
  195. <style scoped lang='scss'>
  196. .tabs {
  197. padding: 30rpx 0 0;
  198. font-size: 30rpx;
  199. font-weight: 600;
  200. margin-bottom: 18rpx;
  201. .active {
  202. position: relative;
  203. &::after {
  204. content: "";
  205. width: 88rpx;
  206. height: 6rpx;
  207. background-color: #2E57FD;
  208. border-radius: 5rpx;
  209. position: absolute;
  210. left: 2rpx;
  211. bottom: -8rpx;
  212. }
  213. }
  214. }
  215. .orderlist {
  216. padding: 28rpx 32rpx;
  217. }
  218. .o_item {
  219. background-color: #fff;
  220. padding: 25rpx 30rpx;
  221. border-radius: 16rpx;
  222. margin-bottom: 20rpx;
  223. // box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  224. &:last-child {
  225. margin-bottom: 0;
  226. }
  227. .p1 {
  228. .name_tit {
  229. font-size: 36rpx;
  230. margin-bottom: 16rpx;
  231. width: calc(100% - 110rpx);
  232. }
  233. .status {
  234. font-size: 26rpx;
  235. color: #666;
  236. width: 110rpx;
  237. text-align: right;
  238. }
  239. }
  240. .p2 {
  241. background-color: rgba($color: #000, $alpha: 0.06);
  242. border-radius: 10rpx;
  243. padding: 20rpx;
  244. margin-bottom: 16rpx;
  245. }
  246. .goods {
  247. width: calc(100% - 160rpx);
  248. .imgs {
  249. width: 150rpx;
  250. margin-right: 16rpx;
  251. display: inline-block;
  252. &:last-child {
  253. margin-right: 0;
  254. }
  255. .g_img {
  256. width: 150rpx;
  257. height: 100rpx;
  258. border-radius: 8rpx;
  259. object-fit: cover;
  260. }
  261. .g_img1 {
  262. height: 220rpx;
  263. }
  264. .na {
  265. font-size: 24rpx;
  266. text-align: center;
  267. }
  268. }
  269. }
  270. .good2 {
  271. .p {
  272. font-size: 28rpx;
  273. }
  274. }
  275. .Movie {
  276. // padding: 25rpx 28rpx;
  277. width: 100%;
  278. .info,
  279. .poster {
  280. vertical-align: text-top;
  281. }
  282. .info {
  283. width: calc(100% - 180rpx);
  284. min-height: 220rpx;
  285. p {
  286. font-size: 26rpx;
  287. color: #666;
  288. margin-bottom: 8rpx;
  289. }
  290. .pt {
  291. font-weight: bold;
  292. color: #000;
  293. font-size: 30rpx;
  294. margin-bottom: 8rpx;
  295. }
  296. .p {
  297. color: #000;
  298. }
  299. }
  300. .poster {
  301. width: 150rpx;
  302. height: 220rpx;
  303. border-radius: 12rpx;
  304. }
  305. }
  306. .g_amount {
  307. display: flex;
  308. flex-direction: column;
  309. justify-content: center;
  310. }
  311. .amount {
  312. font-size: 32rpx;
  313. width: 160rpx;
  314. text-align: right;
  315. &::before {
  316. content: "¥";
  317. font-size: 24rpx;
  318. }
  319. }
  320. .p3 {
  321. font-size: 24rpx;
  322. color: #999;
  323. }
  324. }
  325. .mt-10 {
  326. margin-top: 10rpx;
  327. }
  328. </style>