index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box bgc-F5F4F9">
  3. <newNav textName="订单" navBackgroundColor='#fff' titleColor='#333' leftIconColor="#333"></newNav>
  4. <view v-if="list.length <= 0" class="scroll-view-css">
  5. <EnBlank :customSrc='true'>
  6. <template v-slot:blankImg>
  7. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  8. </template>
  9. </EnBlank>
  10. </view>
  11. <scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  12. <view class="list-box p-20 box-border-box">
  13. <view class="list-item bgc-f b-rad-20 mb-32 p-24 box-border-box" v-for="(item,index) in list"
  14. @click="goToInfo(item)">
  15. <view class="align-items-center flex-justify-space mb-24">
  16. <view class="align-items-center">
  17. <image class="shops-img mr-4" src="@/static/img/order-food/shop-icon.png" mode=""></image>
  18. <view class="fs-30 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  19. {{item.shop_name}}
  20. </view>
  21. </view>
  22. <view class="fc-41ABF5 fs-28">
  23. {{item.order_status_str}}
  24. </view>
  25. </view>
  26. <view class="align-items-center flex-justify-space mb-24">
  27. <view class="goods-box">
  28. <view class="" v-if="item.item.length == 1">
  29. <view class="align-items-center" v-for="(itemGoods,indexGoods) in item.item">
  30. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFill">
  31. </image>
  32. <view class="fs-28 fc-6 text-overflow-ellipsis">
  33. {{itemGoods.goods_name}}
  34. </view>
  35. </view>
  36. </view>
  37. <view class="align-items-center goods-two" v-else>
  38. <view class="flex-direction" v-for="(itemGoods,indexGoods) in item.item">
  39. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFill">
  40. </image>
  41. <view
  42. class="fs-28 fc-6 text-overflow-ellipsis-one goods-two-name text-align-center">
  43. {{itemGoods.goods_name}}
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="goods-num fc-6 fs-24 text-align-center">
  49. 共 {{item.goods_number}} 件
  50. </view>
  51. </view>
  52. <view class="align-items-center flex-justify-space mb-24">
  53. <view class="fs-24 fc-9">
  54. 下单时间:{{item.created_at}}
  55. </view>
  56. <view class="align-items-center">
  57. <view class="fs-28 fc-9">
  58. 实付
  59. </view>
  60. <view class="fs-32 fc-3 fw-600">
  61. ¥{{item.pay_money}}
  62. </view>
  63. </view>
  64. </view>
  65. <view class="align-items-center flex-justify-end">
  66. <view v-if="item.order_status === 1" @click.stop="orderPay(item)" class="item-but but-class-one fs-28">
  67. 立即支付
  68. </view>
  69. <view v-else @click.stop="goToUrl(item)" class="item-but but-class-one fs-28">
  70. 再来一单
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </scroll-view>
  76. </view>
  77. </template>
  78. <script>
  79. // import UniQrcode from 'uniapp-qrcode'
  80. import tools from '@/service/tools';
  81. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  82. import {
  83. commonRefundReason
  84. } from "@/api/common.js"
  85. import {
  86. orderList,
  87. orderCancel,
  88. orderPay
  89. } from "@/api/order.js"
  90. import {
  91. expressOrderCancel
  92. } from "@/api/expressOrder.js"
  93. import {
  94. errandsOrderCancel
  95. } from "@/api/errandsOrder.js"
  96. import {
  97. laundryOrderCancel,
  98. laundryPay
  99. } from "@/api/laundryOrder.js"
  100. export default {
  101. components: {
  102. EnBlank
  103. },
  104. data() {
  105. return {
  106. type: 1,
  107. page: 1,
  108. list: [],
  109. total: 0,
  110. navTypeData: [],
  111. navTypeKey: 0,
  112. isAjax: false,
  113. qrcodeData: '',
  114. options2: {},
  115. onlyCode: '',
  116. refundReason: [],
  117. order_id: 0,
  118. refund_msg: '', // 退款理由
  119. sureType: 0
  120. };
  121. },
  122. onShow() {},
  123. onLoad() {
  124. this.orderList()
  125. },
  126. onHide() {},
  127. onUnload() {},
  128. mounted() {},
  129. methods: {
  130. goToUrl(item) {
  131. // 再来一单
  132. // uni.navigateTo({
  133. // url: '/pages-takeout/shop?shop_id=' + item.shop_id
  134. // })
  135. },
  136. goToInfo(item) {
  137. uni.navigateTo({
  138. url: `/pages-order/takeout-info?orderId=` + item.id
  139. })
  140. },
  141. orderPay(item) {
  142. // 立即支付
  143. this.takeawayPay(item.id)
  144. },
  145. scrolltolower() {
  146. ++this.page
  147. this.orderList()
  148. // console.log('触底');
  149. },
  150. orderList() {
  151. // 订单列表
  152. orderList({
  153. page: this.page
  154. }).then((res) => {
  155. if (res.code == 1) {
  156. this.total = res.data.total
  157. this.list = [...this.list, ...res.data.items]
  158. }
  159. })
  160. },
  161. takeawayPay(id) {
  162. // 外卖支付
  163. if (this.isAJAX) {
  164. return
  165. }
  166. this.isAJAX = true;
  167. orderPay({
  168. order_id: id
  169. }).then((ret) => {
  170. if (ret.code === 1) {
  171. uni.requestPayment({
  172. provider: "wxpay", //支付类型-固定值
  173. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  174. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  175. package: ret.data.wx_pay.package, // 固定值
  176. signType: ret.data.wx_pay.signType, //固定值
  177. paySign: ret.data.wx_pay.paySign, //签名
  178. success: (ren) => {
  179. tools.success("支付成功");
  180. this.isAJAX = false;
  181. this.page = 1;
  182. this.list = [];
  183. this.orderList()
  184. },
  185. fail: (err) => {
  186. this.isAJAX = false;
  187. tools.error("支付失败");
  188. },
  189. });
  190. } else {
  191. this.isAJAX = false;
  192. tools.error("支付失败");
  193. }
  194. })
  195. },
  196. },
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .pop-b {
  201. height: 80rpx;
  202. line-height: 80rpx;
  203. border-radius: 20rpx;
  204. // border: 1rpx solid #F9F9F9;
  205. }
  206. .popup-reason-box {
  207. width: 100%;
  208. height: 45vh;
  209. overflow: auto;
  210. border-radius: 20rpx 20rpx 0 0;
  211. background: #fff;
  212. padding: 24rpx 0 0;
  213. box-sizing: border-box;
  214. }
  215. .picker-view {
  216. width: 100%;
  217. // height: 70%;
  218. }
  219. .picker-view-item {
  220. // height: 90rpx;
  221. line-height: 68rpx;
  222. text-align: center;
  223. background: #F5F5F5;
  224. }
  225. .nav-b {
  226. position: relative;
  227. z-index: -1 !important;
  228. }
  229. .nav-box {
  230. padding: 26rpx 44rpx;
  231. overflow-x: scroll;
  232. .nav-item {
  233. white-space: nowrap;
  234. position: relative;
  235. .nav-item-x {
  236. position: absolute;
  237. width: 48rpx;
  238. height: 6rpx;
  239. border-radius: 20rpx;
  240. background-color: #41ABF5;
  241. left: calc(50% - 24rpx);
  242. bottom: -10rpx;
  243. }
  244. }
  245. }
  246. .nav-type-box {
  247. width: 100%;
  248. white-space: nowrap;
  249. }
  250. .nav-type-item {
  251. width: 144rpx;
  252. height: 64rpx;
  253. line-height: 64rpx;
  254. margin: 0 24rpx 0 0;
  255. border-radius: 200rpx;
  256. display: inline-block;
  257. }
  258. .nav-type-item:last-child {
  259. margin: 0;
  260. }
  261. .shops-img {
  262. width: 48rpx;
  263. height: 48rpx;
  264. }
  265. .shops-name {
  266. max-width: 422rpx;
  267. margin: 0 8rpx 0 0;
  268. }
  269. .icons {
  270. width: 32rpx;
  271. height: 32rpx;
  272. }
  273. .goods-box {
  274. max-width: 506rpx;
  275. height: auto;
  276. }
  277. .goods-num {
  278. width: 24rpx;
  279. height: auto;
  280. }
  281. .goods-img {
  282. width: 144rpx;
  283. height: 144rpx;
  284. border-radius: 12rpx;
  285. margin: 0 16rpx 0 0;
  286. }
  287. .goods-two {
  288. overflow-x: scroll;
  289. overflow: auto;
  290. }
  291. .goods-two-name {
  292. width: 144rpx;
  293. }
  294. .item-but {
  295. width: 160rpx;
  296. height: 64rpx;
  297. line-height: 64rpx;
  298. text-align: center;
  299. border-radius: 200rpx;
  300. }
  301. .but-class-one {
  302. background: linear-gradient(270deg, #FF3333 0%, #FE6122 100%);
  303. color: #fff;
  304. }
  305. .but-class-two {
  306. background: #fff;
  307. border: 2rpx solid #CCCCCC;
  308. color: #333;
  309. }
  310. </style>