index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. this.getOrderListData()
  70. checkLogin().then(res => {
  71. this.hasLogin=res.status==200
  72. if(this.hasLogin){
  73. this.pageInit()
  74. }else{
  75. this.noDataText="您尚未登录或登录已过期,完成登录后可查看数据信息!"
  76. }
  77. })
  78. },
  79. methods:{
  80. // 数据展开收起
  81. itemChange(item) {
  82. this.nowId=item.id
  83. console.log('点击收起隐藏')
  84. this.$nextTick(function(){
  85. item.isUp = !item.isUp
  86. })
  87. },
  88. //拨打电话
  89. callPhone(phone) {
  90. uni.makePhoneCall({
  91. phoneNumber: phone
  92. });
  93. },
  94. // 获取订单列表
  95. getOrderListData(){
  96. getOrderList({orderStatus:'CONFIRM'}).then(res=>{
  97. if(res.status==200){
  98. if(res.data){
  99. res.data.forEach(item => {
  100. item.isUp = false
  101. })
  102. }
  103. this.$nextTick(function(){
  104. this.orderList=res.data || []
  105. })
  106. console.log(this.orderList,'------------this.orderList')
  107. }
  108. })
  109. },
  110. // 取消订单
  111. chooseReason(e){
  112. console.log(e,'-------取消订单')
  113. cancelOrder({id:this.nowId,cancelReason:e}).then(res=>{
  114. if(res.status==200){
  115. uni.showToast({
  116. title: res.message,
  117. icon: 'none'
  118. })
  119. setTimeout(()=>{
  120. this.getOrderListData()
  121. },500)
  122. }
  123. })
  124. },
  125. }
  126. }
  127. </script>
  128. <style lang="less">
  129. .content{
  130. width: 100%;
  131. height: 100vh;
  132. padding: 20upx 30upx;
  133. background-color: #f5f5f5;
  134. .order-content{
  135. padding: 30upx;
  136. background-color: #fff;
  137. display: flex;
  138. flex-direction: column;
  139. border-radius: 12px;
  140. font-family: PingFang SC;
  141. margin-bottom: 20upx;
  142. .item-userInfo{
  143. display: flex;
  144. align-items: center;
  145. justify-content: space-between;
  146. .userInfo{
  147. display: flex;
  148. align-items: center;
  149. .userInfo-nameOrPhone{
  150. margin-left: 20upx;
  151. font-size: 28upx;
  152. .name{
  153. padding: 5upx 0;
  154. font-weight: bold;
  155. color: #222;
  156. }
  157. .phone{
  158. display: flex;
  159. padding: 5upx 0;
  160. font-weight: 400;
  161. color: #999;
  162. }
  163. }
  164. }
  165. }
  166. .item1{
  167. padding-bottom: 20upx;
  168. }
  169. .item-userInfo-detail{
  170. padding: 30upx 0;
  171. view:not(last-child){
  172. padding-bottom: 10upx;
  173. }
  174. .detail-title{
  175. font-size: 32upx;
  176. font-weight: 400;
  177. color:#222
  178. }
  179. .coucntinfo{
  180. font-size: 28upx;
  181. .coucntname{
  182. display: inline-block;
  183. margin-right: 20upx;
  184. }
  185. }
  186. .address{
  187. font-size: 28upx;
  188. color: #999;
  189. }
  190. }
  191. .item-userInfo-detail-image{
  192. display: flex;
  193. padding-bottom: 30upx;
  194. .detail-image{
  195. margin-right: 20upx;
  196. }
  197. }
  198. .btn{
  199. display: flex;
  200. justify-content: flex-end;
  201. }
  202. .cancelBtn{
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. width: 80px;
  207. border-radius: 6px;
  208. padding: 10upx 0;
  209. margin-top: 30upx;
  210. background-color: #e5e5e5;
  211. }
  212. }
  213. .nodata{
  214. width: 100%;
  215. height: 100vh;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. }
  221. </style>