index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="content">
  3. <view v-for="item in orderList" class="order-content">
  4. <view class="item-userInfo item1" @click="itemChange(item)">
  5. <view class="userInfo">
  6. <u-image src="/static/order_avatar_rider.png" width="72" height="72" shape="circle"></u-image>
  7. <view class="userInfo-nameOrPhone">
  8. <view class="name">{{item.name}}</view>
  9. <view class="phone" @click.stop="callPhone(item.phone)"><u-icon name="phone" size="36"></u-icon><view style="margin-left: 10upx;">{{item.phone}}</view></view>
  10. </view>
  11. </view>
  12. <view>
  13. <u-icon v-show="item.isUp" name="arrow-up" color="#999" size="36" ></u-icon>
  14. <u-icon v-show="!item.isUp" name="arrow-down" color="#999" size="36"></u-icon>
  15. </view>
  16. </view>
  17. <view v-show="item.isUp">
  18. <u-line color="#e5e5e5" />
  19. <view class="item-userInfo-detail">
  20. <view class="detail-title">用户信息</view>
  21. <view class="detail-title coucntinfo"><text class="coucntname">{{item.contactName}}</text><text>{{item.contactMobile}}</text></view>
  22. <view class="detail-title address">{{item.contactAddress}}{{item.houseAddress}}</view>
  23. </view>
  24. <u-line color="#e5e5e5"/>
  25. <view class="item-userInfo-detail detail-title">订单信息</view>
  26. <u-line color="#e5e5e5"/>
  27. <view class="item-userInfo item-userInfo-detail"><text class="address">订单编号</text><text class="detail-title">{{item.orderReserveNo}}</text></view>
  28. <u-line color="#e5e5e5"/>
  29. <view class="item-userInfo item-userInfo-detail"><text class="address">预约时间</text><text class="detail-title">{{item.reserveDateBegin.substring(0,10)}} {{item.reserveTimeTypeDictValue}}</text></view>
  30. <u-line color="#e5e5e5"/>
  31. <view class="item-userInfo item-userInfo-detail"><text class="address">下单时间</text><text class="detail-title">{{item.createDate}}</text></view>
  32. <u-line color="#e5e5e5"/>
  33. <view class="item-userInfo item-userInfo-detail"><text class="address">预估重量</text><text class="detail-title">{{item.reserveWeightDictValue}}</text></view>
  34. <u-line color="#e5e5e5"/>
  35. <view class="item-userInfo item-userInfo-detail"><text class="address">预约品类</text><text class="detail-title">{{item.reserveRubbishType}}</text></view>
  36. <view class="item-userInfo-detail-image">
  37. <u-image :src="img" v-for=" img in item.imageList" width="120" height="120" class="detail-image"></u-image>
  38. </view>
  39. <u-line color="#e5e5e5"/>
  40. <view class="btn">
  41. <v-select :showSelete="false" :showBtn="true" class="cancelBtn" @itemChange="chooseReason()" code="CANCEL_REASON" ></v-select>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="nodata" v-if="!hasLogin && orderList.length==0 ">
  46. <!-- <u-empty :text="noDataText" mode="data"></u-empty> -->
  47. <u-empty src="/static/def_result.png" :text="noDataText" icon-size="260" ></u-empty>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import vSelect from '@/components/select/v-select.vue'
  53. import { checkLogin } from '@/api/login.js'
  54. import {getOrderList,cancelOrder} from '@/api/order.js'
  55. export default{
  56. components: {vSelect},
  57. data(){
  58. return{
  59. noDataText:'',
  60. showSelect:false,
  61. nowId:'', // 当前订单id
  62. orderList:[]
  63. }
  64. },
  65. onLoad() {
  66. // this.getOrderListData()
  67. },
  68. onShow() {
  69. checkLogin().then(res => {
  70. this.hasLogin=res.status==200
  71. if(this.hasLogin){
  72. this.getOrderListData()
  73. }else{
  74. this.noDataText="您尚未登录或登录已过期!"
  75. }
  76. })
  77. },
  78. methods:{
  79. // 数据展开收起
  80. itemChange(item) {
  81. this.nowId=item.id
  82. console.log('点击收起隐藏')
  83. this.$nextTick(function(){
  84. item.isUp = !item.isUp
  85. })
  86. },
  87. //拨打电话
  88. callPhone(phone) {
  89. uni.makePhoneCall({
  90. phoneNumber: phone
  91. });
  92. },
  93. // 获取订单列表
  94. getOrderListData(){
  95. getOrderList({orderStatus:'CONFIRM'}).then(res=>{
  96. if(res.status==200){
  97. if(res.data){
  98. res.data.forEach(item => {
  99. item.isUp = false
  100. })
  101. }
  102. this.orderList=res.data || []
  103. this.noDataText = '暂无数据'
  104. console.log(this.orderList,'------------this.orderList')
  105. } else {
  106. this.orderList = []
  107. this.noDataText = res.message
  108. }
  109. })
  110. },
  111. // 取消订单
  112. chooseReason(e){
  113. console.log(e,'-------取消订单')
  114. cancelOrder({id:this.nowId,cancelReason:e}).then(res=>{
  115. if(res.status==200){
  116. uni.showToast({
  117. title: res.message,
  118. icon: 'none'
  119. })
  120. setTimeout(()=>{
  121. this.getOrderListData()
  122. },500)
  123. }
  124. })
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="less">
  130. .content{
  131. width: 100%;
  132. height: 100vh;
  133. padding: 20upx 30upx;
  134. background-color: #f5f5f5;
  135. .order-content{
  136. padding: 30upx;
  137. background-color: #fff;
  138. display: flex;
  139. flex-direction: column;
  140. border-radius: 12px;
  141. font-family: PingFang SC;
  142. margin-bottom: 20upx;
  143. .item-userInfo{
  144. display: flex;
  145. align-items: center;
  146. justify-content: space-between;
  147. .userInfo{
  148. display: flex;
  149. align-items: center;
  150. .userInfo-nameOrPhone{
  151. margin-left: 20upx;
  152. font-size: 28upx;
  153. .name{
  154. padding: 5upx 0;
  155. font-weight: bold;
  156. color: #222;
  157. }
  158. .phone{
  159. display: flex;
  160. padding: 5upx 0;
  161. font-weight: 400;
  162. color: #999;
  163. }
  164. }
  165. }
  166. }
  167. .item1{
  168. padding-bottom: 20upx;
  169. }
  170. .item-userInfo-detail{
  171. padding: 30upx 0;
  172. view:not(last-child){
  173. padding-bottom: 10upx;
  174. }
  175. .detail-title{
  176. font-size: 32upx;
  177. font-weight: 400;
  178. color:#222
  179. }
  180. .coucntinfo{
  181. font-size: 28upx;
  182. .coucntname{
  183. display: inline-block;
  184. margin-right: 20upx;
  185. }
  186. }
  187. .address{
  188. font-size: 28upx;
  189. color: #999;
  190. }
  191. }
  192. .item-userInfo-detail-image{
  193. display: flex;
  194. padding-bottom: 30upx;
  195. .detail-image{
  196. margin-right: 20upx;
  197. }
  198. }
  199. .btn{
  200. display: flex;
  201. justify-content: flex-end;
  202. }
  203. .cancelBtn{
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. width: 80px;
  208. border-radius: 6px;
  209. padding: 10upx 0;
  210. margin-top: 30upx;
  211. background-color: #e5e5e5;
  212. }
  213. }
  214. .nodata{
  215. width: 100%;
  216. height: 100vh;
  217. display: flex;
  218. justify-content: center;
  219. align-items: center;
  220. }
  221. }
  222. </style>