index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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"><u-icon name="phone"></u-icon><text>{{item.phone}}</text></view>
  10. </view>
  11. </view>
  12. <view>
  13. <u-icon v-show="item.isUp" name="arrow-up" color="#999" size="28"></u-icon>
  14. <u-icon v-show="!item.isUp" name="arrow-down" color="#999" size="28"></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}}</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.reserveWeight}}</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="userInfo cancelBtn" :showBtn="true"><u-button :custom-style="cancelBtn" :hair-line="false" @click="cancelOrder">取消订单</u-button></view> -->
  41. <view class="btn">
  42. <v-select :showSelete="false" :showBtn="true" class="cancelBtn" @itemChange="chooseReason()" code="CANCEL_REASON" ></v-select>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="nodata" v-if="!hasLogin && orderList.length==[] ">
  47. <u-empty :text="noDataText" mode="data"></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. getOrderListData(){
  89. getOrderList({orderStatus:'CONFIRM'}).then(res=>{
  90. if(res.status==200){
  91. if(res.data){
  92. res.data.forEach(item => {
  93. item.isUp = false
  94. })
  95. }
  96. this.$nextTick(function(){
  97. this.orderList=res.data || []
  98. })
  99. console.log(this.orderList,'------------this.orderList')
  100. }
  101. })
  102. },
  103. // 取消订单
  104. chooseReason(e){
  105. console.log(e,'-------取消订单')
  106. cancelOrder({id:this.nowId,canReson:e}).then(res=>{
  107. if(res.status==200){
  108. uni.showToast({
  109. title: res.message,
  110. icon: 'none'
  111. })
  112. setTimeout(()=>{
  113. this.getOrderListData()
  114. },500)
  115. }
  116. })
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="less">
  122. .content{
  123. width: 100%;
  124. height: 100vh;
  125. padding: 20upx 30upx;
  126. background-color: #f5f5f5;
  127. .order-content{
  128. padding: 30upx;
  129. background-color: #fff;
  130. display: flex;
  131. flex-direction: column;
  132. border-radius: 12px;
  133. font-family: PingFang SC;
  134. margin-bottom: 20upx;
  135. .item-userInfo{
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-between;
  139. .userInfo{
  140. display: flex;
  141. .userInfo-nameOrPhone{
  142. margin-left: 20upx;
  143. font-size: 28upx;
  144. .name{
  145. font-weight: bold;
  146. color: #222;
  147. }
  148. .phone{
  149. font-weight: 400;
  150. color: #999;
  151. }
  152. }
  153. }
  154. }
  155. .item1{
  156. padding-bottom: 20upx;
  157. }
  158. .item-userInfo-detail{
  159. padding: 30upx 0;
  160. view:not(last-child){
  161. padding-bottom: 10upx;
  162. }
  163. .detail-title{
  164. font-size: 32upx;
  165. font-weight: 400;
  166. color:#222
  167. }
  168. .coucntinfo{
  169. font-size: 28upx;
  170. .coucntname{
  171. display: inline-block;
  172. margin-right: 20upx;
  173. }
  174. }
  175. .address{
  176. font-size: 28upx;
  177. color: #999;
  178. }
  179. }
  180. .item-userInfo-detail-image{
  181. display: flex;
  182. padding-bottom: 30upx;
  183. .detail-image{
  184. margin-right: 20upx;
  185. }
  186. }
  187. .btn{
  188. display: flex;
  189. justify-content: flex-end;
  190. }
  191. .cancelBtn{
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. width: 80px;
  196. border-radius: 6px;
  197. padding: 10upx 0;
  198. margin-top: 30upx;
  199. background-color: #e5e5e5;
  200. }
  201. }
  202. }
  203. </style>