index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view>
  3. <view class="top-1">
  4. <!-- 状态栏高度 -->
  5. <view :style="{ height: `${statusBarHeight}px` }"></view>
  6. <!-- 导航栏 -->
  7. <view :style="{ height: `${navigationBarHeight}px`,lineHeight: `${navigationBarHeight}px`}" class="order-nav">订单
  8. </view>
  9. <!-- 进行中/历史订单 -->
  10. <view class="status-bar">
  11. <view>
  12. <text :class="isShow==0? 'status-true': 'status-false'" @click="statusClick(0)">进行中</text>
  13. <text :class="isShow==1? 'status-true': 'status-false'" @click="statusClick(1)">历史订单</text>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 列表数据 -->
  18. <view class="nbox-1" v-if="list.length">
  19. <view class="nbox-2" v-for="(item,index) in list" :key="index">
  20. <view class="container" @click='goOrderDetails(item)'>
  21. <text class="left-text">{{item.merName}}</text>
  22. <view class="right-group">
  23. <text v-if="item.status==1||item.status==2||item.status==3" style="color: #0FBA42;font-size: 23rpx;">制作中</text>
  24. <text v-if="item.status==4" style="color: #FF5500;font-size: 23rpx;">待取餐</text>
  25. <image src="/static/img/ic-yx.png" class="image" />
  26. </view>
  27. </view>
  28. <view class="scroll-container" v-for='(ottm,indexs) in item.orderInfoList' :key="indexs" @click='goOrderDetails(item)'>
  29. <view class="item">
  30. <img :src='ottm.image'>
  31. <text>{{ottm.productName}} x{{ottm.payNum}}</text>
  32. </view>
  33. </view>
  34. <view class="dashed-line"></view>
  35. <view style="text-align: right; font-size: 23rpx; color: #141414;padding-right: 20rpx;">
  36. 共{{item.orderInfoList.length}}件,实付 ¥{{ item.payPrice}}元
  37. </view>
  38. <view class="container2">
  39. <text v-if="item.status==1||item.status==2||item.status==3" class="left-text2">商家正在备餐中</text>
  40. <text v-if="item.status==4" class="left-text2">商家备餐完成</text>
  41. <view class="right-group">
  42. <image src="/static/img/ic-iphone1.png" class="image2" />
  43. <text @click="makePhoneCall(item)" style="color: #141414;font-size: 21rpx;">联系商家</text>
  44. <view style="display: inline-block; width: 2rpx; height: 42rpx;border: 2rpx solid #D5D6DC;"></view>
  45. <!-- 留言字段 -->
  46. <image src="/static/img/ic-message1.png" class="image2" />
  47. <text style="color: #141414;font-size: 21rpx;" @click="modify(item, 1)">留言</text>
  48. </view>
  49. <PriceChange :change="change" :orderInfo="orderInfo" :isRefund="isRefund"
  50. v-on:statusChange="statusChange($event)" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
  51. :status="status"></PriceChange>
  52. </view>
  53. </view>
  54. <view class='loadingicon flex-center' :hidden='!loading'>
  55. <text class='loading iconfont icon-jiazai' style="width: auto;"></text>加载更多
  56. </view>
  57. <view class="flex-center no-data-tip" v-if="loadTitle">{{loadTitle}}</view>
  58. </view>
  59. <emptyPage v-else title="暂无订单~" :imgSrc="urlDomain+'crmebimage/presets/noShopper.png'"></emptyPage>
  60. </view>
  61. </template>
  62. <script>
  63. import PriceChange from "./PriceChange/index.vue";
  64. import emptyPage from '@/components/emptyPage.vue'
  65. import {
  66. ProductTypeEnum,
  67. } from "@/enums/productEnums";
  68. import {
  69. userMark,
  70. getOrderList
  71. } from '@/api/order.js';
  72. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  73. let app = getApp();
  74. export default {
  75. components: {
  76. emptyPage,
  77. PriceChange
  78. },
  79. data() {
  80. return {
  81. urlDomain: this.$Cache.get("imgHost"),
  82. statusBarHeight: app.globalData.statusBarHeight,
  83. navigationBarHeight: 0,
  84. isShow: 0,
  85. loading: false,
  86. noDataTip: '',
  87. loadTitle: '',
  88. page: 1,
  89. list: [], //订单数据
  90. ProductTypeEnum,
  91. change:false,
  92. orderInfo:{},
  93. status: ""
  94. }
  95. },
  96. //下拉刷新
  97. onPullDownRefresh() {
  98. },
  99. onLoad(options) {
  100. let that = this;
  101. //首页数据加载
  102. // this.getIndexConfig();
  103. // #ifdef MP-WEIXIN
  104. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  105. const custom = wx.getMenuButtonBoundingClientRect()
  106. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  107. this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  108. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  109. // #endif
  110. this.getOrderList() //订单列表
  111. },
  112. onShow() {
  113. },
  114. methods: {
  115. modify: function(item, status) {
  116. this.change = true;
  117. this.status = status.toString();
  118. this.orderInfo = item;
  119. },
  120. changeclose: function(msg) {
  121. this.change = msg;
  122. },
  123. async savePrice(opt) {
  124. let that = this,
  125. data = {};
  126. data.orderNo = that.orderInfo.orderNo;
  127. data.remark=opt.remark
  128. if (!data.remark) {
  129. return this.$util.Tips({
  130. title: '请输入备注'
  131. })
  132. }
  133. userMark(data).then(res=>{
  134. if(res.code==200){
  135. this.$util.Tips({
  136. title: '备注成功'
  137. })
  138. this.getOrderList();
  139. this.change = false
  140. }else{
  141. this.$util.Tips({
  142. title:res.message
  143. })
  144. }
  145. })
  146. },
  147. /**
  148. * 去订单详情
  149. */
  150. goOrderDetails: function(item, status) {
  151. if (item.groupBuyRecordStatus === 0) return this.$util.Tips({
  152. title: '拼团中无法查看详情'
  153. });
  154. if (!item.orderNo) return this.$util.Tips({
  155. title: '缺少订单号无法查看订单详情'
  156. });
  157. //虚拟商品
  158. if (item.secondType === this.ProductTypeEnum?.CloudDrive || item.secondType === this.ProductTypeEnum
  159. ?.CardPassword) {
  160. // #ifdef MP
  161. uni.navigateTo({
  162. url: '/pages/goods/virtual_order_details/index?orderNo=' + item.orderNo
  163. })
  164. // #endif
  165. } else {
  166. // #ifdef MP
  167. uni.navigateTo({
  168. url: '/pages/goods/order_details/index?orderNo=' + item.orderNo + `&orderType=${this.isShow}`
  169. })
  170. // #endif
  171. }
  172. },
  173. // 拨打电话
  174. makePhoneCall(item) {
  175. const phoneNumber = item.merPhone; // 替换为商家的电话号码
  176. uni.makePhoneCall({
  177. phoneNumber: phoneNumber,
  178. success() {
  179. console.log('拨打电话成功');
  180. },
  181. fail() {
  182. console.log('拨打电话失败');
  183. }
  184. });
  185. },
  186. // 头部切换
  187. statusClick(index) {
  188. this.isShow = index;
  189. this.list = []
  190. this.page = 1
  191. this.getOrderList() // 订单列表
  192. },
  193. // 订单列表
  194. getOrderList() {
  195. this.loading = true
  196. getOrderList({
  197. limit: 20, //条数
  198. page: this.page, //页码
  199. orderType: this.isShow, //类型订单类型:0-进行中,1-完成
  200. }).then(res => {
  201. console.log('订单列表', res)
  202. if (res.code == 200) {
  203. const list = res.data.list
  204. this.list = this.$util.SplitArray(list, this.list);
  205. if (this.list.length == 0) {
  206. this.loadTitle = ''
  207. this.noDataTip = ' 暂无外卖商家 ';
  208. } else {
  209. this.noDataTip = ''
  210. this.loadTitle = list.length < 20 ? "我也是有底线的~" : '';
  211. }
  212. this.loading = false
  213. this.page += 1
  214. }
  215. }).catch(err => {
  216. this.loading = false
  217. })
  218. }
  219. },
  220. mounted() {
  221. },
  222. }
  223. </script>
  224. <style scoped>
  225. .order-nav {
  226. font-weight: 500;
  227. font-size: 35rpx;
  228. color: #FFFFFF;
  229. background-color: #FF6702;
  230. text-align: center;
  231. }
  232. .no-data-tip {
  233. color: #CCC;
  234. }
  235. .status-bar {
  236. background-color: #FF6702;
  237. text-align: center;
  238. padding: 20rpx;
  239. box-sizing: border-box;
  240. }
  241. .status-bar view {
  242. display: inline-block;
  243. width: 385rpx;
  244. background: #EB5E00;
  245. border-radius: 37rpx;
  246. }
  247. .status-true {
  248. display: inline-block;
  249. width: 192rpx;
  250. padding: 10rpx 0;
  251. background-color: white;
  252. color: #FF6600;
  253. border-radius: 37rpx;
  254. }
  255. .status-false {
  256. display: inline-block;
  257. width: 192rpx;
  258. padding: 10rpx 0;
  259. color: #FFCBA9;
  260. border-radius: 37rpx;
  261. }
  262. .container {
  263. display: flex;
  264. justify-content: space-between;
  265. align-items: center;
  266. }
  267. .left-text {
  268. font-weight: 600;
  269. font-size: 27rpx;
  270. color: #141414;
  271. margin-left: 40rpx;
  272. }
  273. .right-group {
  274. display: flex;
  275. align-items: center;
  276. gap: 16rpx;
  277. }
  278. .image {
  279. width: 42rpx;
  280. height: 70rpx;
  281. margin-right: 20rpx;
  282. }
  283. .container2 {
  284. display: flex;
  285. justify-content: space-between;
  286. align-items: center;
  287. background-color: #F8F9FB;
  288. margin: 20rpx 20rpx 0 20rpx;
  289. padding: 20rpx 40rpx 20rpx 20rpx;
  290. }
  291. .left-text2 {
  292. font-weight: 600;
  293. color: #141414;
  294. font-size: 23rpx;
  295. margin-left: 0;
  296. }
  297. .image2 {
  298. width: 42rpx;
  299. height: 42rpx;
  300. }
  301. .scroll-container {
  302. display: flex;
  303. overflow-x: auto;
  304. /* 允许水平滚动 */
  305. white-space: nowrap;
  306. /* 防止项目换行 */
  307. padding: 8rpx 20rpx 20rpx 40rpx;
  308. /* 添加一些内边距 */
  309. -webkit-overflow-scrolling: touch;
  310. /* 在iOS上平滑滚动 */
  311. }
  312. .item {
  313. display: inline-flex;
  314. /* 或者使用 flex 但需要调整 */
  315. flex-direction: column;
  316. align-items: center;
  317. margin-right: 20rpx;
  318. /* 项目之间的间距 */
  319. flex: 0 0 auto;
  320. /* 防止项目伸缩 */
  321. }
  322. .item img {
  323. width: 115rpx;
  324. height: 115rpx;
  325. border-radius: 12rpx;
  326. /* 可选:圆形图片 */
  327. object-fit: cover;
  328. /* 保持图片比例 */
  329. }
  330. .item text {
  331. margin-top: 10rpx;
  332. /* 图片和文字之间的间距 */
  333. font-size: 21rpx;
  334. color: #141414;
  335. text-align: center;
  336. white-space: nowrap;
  337. /* 防止文字换行 */
  338. }
  339. .dashed-line {
  340. border-bottom: 2rpx dashed #D6D7DC;
  341. width: 90%;
  342. /* 确保宽度足够 */
  343. height: 2rpx;
  344. /* 控制线条高度 */
  345. margin: 0 40rpx 18rpx 40rpx;
  346. }
  347. .nbox-1 {
  348. padding: 20rpx;
  349. box-sizing: border-box;
  350. display: flex;
  351. flex-direction: column;
  352. gap: 20rpx;
  353. }
  354. .nbox-2 {
  355. background: #FFF;
  356. padding: 15rpx;
  357. box-sizing: border-box;
  358. }
  359. .top-1 {
  360. background-color: #FF6702;
  361. position: sticky;
  362. top: 0;
  363. }
  364. </style>