index.vue 5.8 KB

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