index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 {getOrderList,cancelOrder} from '@/api/order.js'
  54. export default{
  55. components: {vSelect},
  56. data(){
  57. return{
  58. noDataText:'',
  59. showSelect:false,
  60. nowId:'', // 当前订单id
  61. orderList:[]
  62. }
  63. },
  64. onLoad() {
  65. // this.getOrderListData()
  66. },
  67. onShow() {
  68. this.getOrderListData()
  69. checkLogin().then(res => {
  70. this.hasLogin=res.status==200
  71. if(this.hasLogin){
  72. this.pageInit()
  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.$nextTick(function(){
  103. this.orderList=res.data || []
  104. })
  105. console.log(this.orderList,'------------this.orderList')
  106. }
  107. })
  108. },
  109. // 取消订单
  110. chooseReason(e){
  111. console.log(e,'-------取消订单')
  112. cancelOrder({id:this.nowId,cancelReason:e}).then(res=>{
  113. if(res.status==200){
  114. uni.showToast({
  115. title: res.message,
  116. icon: 'none'
  117. })
  118. setTimeout(()=>{
  119. this.getOrderListData()
  120. },500)
  121. }
  122. })
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="less">
  128. .content{
  129. width: 100%;
  130. height: 100vh;
  131. padding: 20upx 30upx;
  132. background-color: #f5f5f5;
  133. .order-content{
  134. padding: 30upx;
  135. background-color: #fff;
  136. display: flex;
  137. flex-direction: column;
  138. border-radius: 12px;
  139. font-family: PingFang SC;
  140. margin-bottom: 20upx;
  141. .item-userInfo{
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-between;
  145. .userInfo{
  146. display: flex;
  147. align-items: center;
  148. .userInfo-nameOrPhone{
  149. margin-left: 20upx;
  150. font-size: 28upx;
  151. .name{
  152. padding: 5upx 0;
  153. font-weight: bold;
  154. color: #222;
  155. }
  156. .phone{
  157. display: flex;
  158. padding: 5upx 0;
  159. font-weight: 400;
  160. color: #999;
  161. }
  162. }
  163. }
  164. }
  165. .item1{
  166. padding-bottom: 20upx;
  167. }
  168. .item-userInfo-detail{
  169. padding: 30upx 0;
  170. view:not(last-child){
  171. padding-bottom: 10upx;
  172. }
  173. .detail-title{
  174. font-size: 32upx;
  175. font-weight: 400;
  176. color:#222
  177. }
  178. .coucntinfo{
  179. font-size: 28upx;
  180. .coucntname{
  181. display: inline-block;
  182. margin-right: 20upx;
  183. }
  184. }
  185. .address{
  186. font-size: 28upx;
  187. color: #999;
  188. }
  189. }
  190. .item-userInfo-detail-image{
  191. display: flex;
  192. padding-bottom: 30upx;
  193. .detail-image{
  194. margin-right: 20upx;
  195. }
  196. }
  197. .btn{
  198. display: flex;
  199. justify-content: flex-end;
  200. }
  201. .cancelBtn{
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. width: 80px;
  206. border-radius: 6px;
  207. padding: 10upx 0;
  208. margin-top: 30upx;
  209. background-color: #e5e5e5;
  210. }
  211. }
  212. .nodata{
  213. width: 100%;
  214. height: 100vh;
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. }
  219. }
  220. </style>