orderDetails.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <!-- 订单详情 -->
  3. <view>
  4. <u-navbar title="详情" autoBack placeholder></u-navbar>
  5. <view class="card_order_details">
  6. <view class="details_title" style="color: #3c9cff;" v-if="orderData.state == 2">待配送</view>
  7. <view class="details_title" style="color: #f9ae3d;"
  8. v-else-if="orderData.state == 5 || orderData.state == 6">配送中</view>
  9. <view class="details_title" style="color: #5ac725;" v-else-if="orderData.state == 3">已送达</view>
  10. <view class="details_title" style="color: #f56c6c;" v-else-if="orderData.state == 4">已取消</view>
  11. <view class="gas_card">
  12. <image class="gas_iamge" src="../../static/image/bottle.png" mode=""></image>
  13. <view class="gas_card_tl">
  14. <view class="title_gas" v-if="orderData.goods && orderData.spec">
  15. {{orderData.goods.name}}{{orderData.spec.name}}
  16. </view>
  17. <view class="title_gas_num">×{{orderData.quantity}}</view>
  18. </view>
  19. </view>
  20. <view class="details_title1">订单编号: <span>{{orderData.orderId}}</span></view>
  21. <view class="details_title1">配送地址: <span>{{orderData.address}}</span></view>
  22. <view class="details_title1" v-if="orderData.state == 5 || orderData.state == 6 || orderData.state == 4">
  23. 联系电话:
  24. <span>{{orderData.phone}}</span> <u-icon color="#70B603" size="26" name="phone-fill"
  25. @click.native.stop="phone(orderData.phone)"></u-icon>
  26. </view>
  27. <view class="details_title1">下单时间: <span>{{orderData.orderTime}}</span></view>
  28. <view class="details_title1" v-if="orderData.state == 5 || orderData.state == 6 || orderData.state == 4">
  29. 配送时间:
  30. <span>{{orderData.deliveryTime}}</span>
  31. </view>
  32. <view class="details_title1" v-if="orderData.state == 3 || orderData.state == 4">送达时间:
  33. <span>{{orderData.arriveTime}}</span>
  34. </view>
  35. <view class="card_steel_cylinder" v-if="orderData.orderInnerCodeList">
  36. <view class="steel_list_title">钢瓶列表</view>
  37. <u-checkbox-group v-model="checked" @change="checkboxChange">
  38. <view style="width: 100%;display: flex;flex-direction: column;">
  39. <view class="item_steel" v-for="(item,index) in orderData.orderInnerCodeList" :key="index">
  40. <view style="display: flex;align-items: center;">
  41. <u-checkbox :name="item.innerCode" :checked="item.checked"
  42. :disabled="item.state == 2"></u-checkbox>
  43. <view class="steel_title">{{index + 1}}</view>
  44. <view class="steel_title1">{{item.innerCode}}</view>
  45. </view>
  46. <view class="steel_red" v-if="item.state == 2">已取消</view>
  47. </view>
  48. </view>
  49. </u-checkbox-group>
  50. </view>
  51. </view>
  52. <view style="width: 100%;height: 120rpx;"></view>
  53. <view class="btn_cancel" v-if="orderData.state == 3">
  54. <u-button type="error" text="取消订单" @click="cancel"></u-button>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. checked: [],
  63. orderData: {},
  64. arrCode: [],
  65. }
  66. },
  67. mounted() {
  68. var value = uni.getStorageSync('detailsData');
  69. if (value.orderInnerCodeList) {
  70. value.orderInnerCodeList.forEach(item => {
  71. item.checked = false
  72. })
  73. }
  74. this.orderData = value
  75. uni.$on('refresh', () => {
  76. this.getOrderList()
  77. })
  78. },
  79. methods: {
  80. getOrderList() {
  81. var value = uni.getStorageSync('detailsData');
  82. this.orderData = value
  83. },
  84. // 选择钢瓶编号
  85. checkboxChange(value) {
  86. this.arrCode = value
  87. },
  88. cancel() {
  89. if (this.arrCode.length > 0) {
  90. const param = {
  91. id: Number(this.orderData.id),
  92. state: 4,
  93. chipUid: this.arrCode,
  94. }
  95. uni.showLoading({
  96. mask: true,
  97. });
  98. this.$api.put('/api/order/state', param).then(res => {
  99. if (res.code == 200) {
  100. this.frequencyCoding = ''
  101. this.list = []
  102. uni.$u.toast('取消成功')
  103. setTimeout(() => {
  104. uni.$emit('refresh');
  105. uni.navigateBack({
  106. delta: 1
  107. });
  108. }, 1000)
  109. } else {
  110. uni.$u.toast(res.data.msg)
  111. }
  112. uni.hideLoading();
  113. }).catch(() => {
  114. uni.hideLoading();
  115. })
  116. } else {
  117. uni.$u.toast('请选择取消单位内编号')
  118. }
  119. // uni.redirectTo({
  120. // url: '/pages/order/delivery?id=' + '100' + '&title=' + '确定取消' + '&orderId=' + this.orderData.id
  121. // });
  122. },
  123. phone(phone) {
  124. uni.makePhoneCall({
  125. phoneNumber: phone,
  126. success: () => {
  127. console.log('拨打电话成功!');
  128. },
  129. fail: () => {
  130. console.error('拨打电话失败!');
  131. }
  132. });
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .card_order_details {
  139. margin: 20rpx 30rpx;
  140. }
  141. .details_title {
  142. display: flex;
  143. margin-left: 20rpx;
  144. color: #333;
  145. font-size: 32rpx;
  146. font-weight: 500;
  147. }
  148. .gas_card {
  149. margin-top: 20rpx;
  150. display: flex;
  151. }
  152. .gas_iamge {
  153. width: 160rpx;
  154. height: 160rpx;
  155. border-radius: 10rpx;
  156. }
  157. .gas_card_tl {
  158. margin-left: 20rpx;
  159. }
  160. .title_gas {
  161. font-size: 40rpx;
  162. font-weight: 700;
  163. }
  164. .title_gas_num {
  165. font-size: 30rpx;
  166. font-weight: 500;
  167. margin-top: 10rpx;
  168. }
  169. .card_steel_cylinder {
  170. margin-top: 30rpx;
  171. }
  172. .steel_list_title {
  173. font-size: 32rpx;
  174. font-weight: 600;
  175. }
  176. .item_steel {
  177. display: flex;
  178. align-items: center;
  179. justify-content: space-between;
  180. margin: 30rpx 0rpx;
  181. padding-bottom: 20rpx;
  182. border-bottom: 1rpx solid #E4E7ED;
  183. }
  184. .steel_title {
  185. margin-left: 20rpx;
  186. margin-right: 10rpx;
  187. color: #7f7f7f;
  188. font-size: 30rpx;
  189. }
  190. .steel_title1 {
  191. font-size: 30rpx;
  192. }
  193. .steel_red {
  194. color: #fa3534;
  195. font-size: 30rpx;
  196. }
  197. .details_title1 {
  198. display: flex;
  199. align-items: center;
  200. font-size: 26rpx;
  201. color: #7f7f7f;
  202. margin-top: 20rpx;
  203. span {
  204. margin-left: 10rpx;
  205. font-size: 26rpx;
  206. color: #000;
  207. }
  208. }
  209. .btn_cancel {
  210. position: absolute;
  211. bottom: 0;
  212. left: 0;
  213. right: 0;
  214. padding: 20rpx;
  215. background-color: #fff;
  216. }
  217. </style>