selectList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="order-list content ">
  3. <!-- <u-sticky bgColor="#fff" style="height: 60rpx;" class="sicky-height">
  4. <view class="address-text">{{location.address}}</view>
  5. </u-sticky> -->
  6. <view class="monitor-info" v-if="hardInfo && hardInfo.sysType=='101' && hardInfo.isMonitor=='1'">
  7. <monitorWeigh class="monitor-window" :hardInfo="hardInfo">
  8. </monitorWeigh>
  9. </view>
  10. <view class="swiper-box fixed">
  11. <template v-if="orderList.length">
  12. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  13. <u-list-item v-for="(item, index) in orderList" :key="index">
  14. <view class="order-card">
  15. <view class="order-card-title" @click="selectOrder(item)">
  16. <span class="type" v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
  17. <span class="type fixed" v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span>
  18. <span class="type fixed" v-if="item.orderType == '5'">{{ $t('order.plan') }}</span>
  19. <text class="info">{{ item.tenantName || '' }}</text>
  20. <!-- <text class="no">No {{ item.code || '' }}</text> -->
  21. <template v-if="item.orderType != '4'">
  22. <span class="status" v-if="item.orderStatus == '0'">未进厂</span>
  23. <span class="status"
  24. v-if="item.orderStatus == '1' && item.weighingStatus == '0'">已进厂</span>
  25. <span class="status" v-if="item.orderStatus == '2'">已完成</span>
  26. <span class="status"
  27. v-if="item.orderStatus == '1' && item.weighingStatus != '0'">已过磅</span>
  28. <span class="status bad-status" v-if="item.orderStatus == '4'">已作废</span>
  29. </template>
  30. <template v-if="item.orderType == '4'">
  31. <span class="status" v-if="item.orderStatus == '0'">未接单</span>
  32. <span class="status" v-if="item.orderStatus == '1'">接单中</span>
  33. <span class="status" v-if="item.orderStatus == '2'">已完成</span>
  34. <span class="status bad-status"
  35. v-if="item.enabledMarkType =='1' || item.orderStatus == '4'">已作废</span>
  36. </template>
  37. </view>
  38. <view class="order-card-info" @click="selectOrder(item)">
  39. <view class="order-type">
  40. <u-tag :text="$t('order.mixed')" type="success" v-if="item.isMain == 1"></u-tag>
  41. <u-tag :text="$t('order.mixed')" type="success" v-if="item.isMain == 2"></u-tag>
  42. </view>
  43. <view class="row">
  44. <p class="cell">
  45. <!-- <text class="label">{{ $t('order.companyName') }}</text> -->
  46. <text class="info">{{ item.companyName || '' }}</text>
  47. </p>
  48. </view>
  49. <view class="row">
  50. <p class="cell">
  51. <!-- <text class="label">{{ $t('order.orderDate') }}</text> -->
  52. <text class="info">{{ item.setDate || '' }}</text>
  53. </p>
  54. <p class="cell">
  55. <text class="info"
  56. v-if="item.vehicleType == '101'">{{ $t('order.saleOrder') }}</text>
  57. <text class="info"
  58. v-if="item.vehicleType == '102'">{{ $t('order.purchaseOrder') }}</text>
  59. <text class="info"
  60. v-if="item.vehicleType == '103'">{{ $t('order.materialsOrder') }}</text>
  61. <text class="info"
  62. v-if="item.vehicleType == '104'">{{ $t('order.transferOrder') }}</text>
  63. </p>
  64. </view>
  65. <view class="row">
  66. <p class="cell">
  67. <!-- <text class="label">{{ $t('order.materialName') }}</text> -->
  68. <text class="info">{{ item.materialName || '' }}</text>
  69. </p>
  70. <p class="cell">
  71. <!-- <text class="label">{{ $t('order.orderNumber') }}</text> -->
  72. <!-- <text class="info">{{ item.orderNumber || '' }}{{ item.orderType ==
  73. '4' ? $t('customer_meter.unitN') : $t('customer_meter.unitT') }}</text> -->
  74. <text :style="'font-size: 9pt;font-weight: bold;'+(item.companyClientType=='109'?'color: green;':'color: red;')"
  75. class="info">{{ item.orderNumber || '' }}{{item.materialKind=='101' && item.companyClientType=='109'?$t('customer_meter.unitB') :(item.orderType ==
  76. '4' ? $t('customer_meter.unitN') : $t('customer_meter.unitT')) }}</text>
  77. </p>
  78. </view>
  79. <view class="row">
  80. <p class="cell">
  81. <!-- <text class="label">{{ $t('order.driver') }}</text> -->
  82. <text class="info">{{ item.driver || '' }}-{{ item.phone || '' }}</text>
  83. </p>
  84. <p class="cell">
  85. <!-- <text class="label">{{ $t('order.vehicle') }}</text> -->
  86. <text class="info">{{ item.vehicle || '' }}</text>
  87. </p>
  88. </view>
  89. <view class="qrcode-logo" @click="drawQrcode(item)">
  90. <image class="img" src="/subpages/static/czzn-img/state/qrcode.png"
  91. mode=" scaleToFill" />
  92. </view>
  93. <!-- <view class="row" v-if="item.isMain == 1 || item.isMain == 2">
  94. <p class="cell">
  95. <text
  96. class="label">{{ item.isMain == 1 ? $t('order.mainOrder') : $t('order.suppOrder') }}</text>
  97. <text class="info used">{{ item.relationOrderCode || '' }}</text>
  98. </p>
  99. </view> -->
  100. </view>
  101. <view class="code">
  102. <view class="label">{{$t('spare.orderCode')}}</view>
  103. <view class="info">{{ item.code || '' }}</view>
  104. </view>
  105. <view class="order-card-bottom">
  106. <view class="btn">
  107. <u-button class="oper-btn" type='primary' shape="circle" color='#4680F9'
  108. size="small" @click="selectOrder(item)">
  109. {{ $t('mine.select') }}
  110. </u-button>
  111. </view>
  112. <!-- <view class="btn"
  113. v-if="item.orderType == 1 && (item.orderStatus == 0 || item.orderStatus == 1) && item.vehicleType == 101 && item.materialKind == 101 && item.loadFlag == 0 && item.isMain != 1">
  114. <u-button class="oper-btn" type='warning' shape="circle" size="small"
  115. @click="onMixedOrderClick(item)">
  116. {{ $t('base.button.mixed') }}
  117. </u-button>
  118. </view> -->
  119. </view>
  120. </view>
  121. </u-list-item>
  122. </u-list>
  123. </template>
  124. <template v-else>
  125. <u-empty mode="orderTypeList" icon="https://cdn.uviewui.com/uview/empty/list.png">
  126. </u-empty>
  127. </template>
  128. </view>
  129. <!-- <u-loading-page loadingMode='spinner' bg-color="rgba(0,0,0,0.5)" :loading="loading" color="#fff"
  130. loading-color="#fff">
  131. </u-loading-page> -->
  132. <u-popup :show="showQrcode" :round="16" @close="showQrcode = false" mode="center"
  133. :overlayStyle="{ background: '#fff' }">
  134. <view @click="showQrcode = false">
  135. <uqrcode ref='ordercode' canvas-id="order-canvas" :value="currentOrder.id" :start="false" />
  136. <view class="info-line">
  137. {{ $t('mine.customer') }} : {{ currentOrder.companyName || '' }}
  138. </view>
  139. <view class="info-line">
  140. {{ $t('mine.mater') }} : {{ currentOrder.materialName || '' }}
  141. </view>
  142. <view class="info-line" v-if="currentOrder.vehicle">
  143. {{ $t('order.vehicle') }} : {{ currentOrder.vehicle || '' }}
  144. </view>
  145. </view>
  146. </u-popup>
  147. <template>
  148. <view >
  149. <u-modal :show="orderNumberDialog" @confirm="confirm" @cancel="cancel" :showCancelButton="true" title="下单量" >
  150. <!-- 订单数量 -->
  151. <u-input :focus="true" v-if="orderNumberDialog" @focus="onOrderNumberFocus" v-model="orderNumber" border="none" type='digit'
  152. :placeholder="$t('base.common.placeholderI')+$t('order.orderNumber')" >
  153. </u-input>
  154. </u-modal>
  155. </view>
  156. </template>
  157. <u-toast ref="loadingToast"></u-toast>
  158. </view>
  159. </template>
  160. <script>
  161. import {
  162. sendHandleOrder
  163. } from "../../api/order"
  164. import monitorWeigh from '../../components/monitor/weigh/weigh.vue';
  165. export default {
  166. components: {
  167. monitorWeigh
  168. },
  169. data() {
  170. return {
  171. orderList: [],
  172. qrCode: '',
  173. noClick: true,
  174. showQrcode: false,
  175. currentOrder: {},
  176. location: {},
  177. hardInfo: {},
  178. orderNumber:0,
  179. orderNumberDialog:false,
  180. tempItem:{},
  181. };
  182. },
  183. onLoad(options) {
  184. console.log("获取到订单信息、", options.data)
  185. console.log("获取到的硬件信息", options.hardInfo)
  186. this.orderList = options && options.data ? JSON.parse(options.data) : []
  187. this.hardInfo = options && options.hardInfo ? JSON.parse(options.hardInfo) : {}
  188. if (this.orderList.length > 0) {
  189. let tenant = [{
  190. tenantName: this.orderList[0].tenantName,
  191. tenantId: this.orderList[0].tenantId,
  192. tenantCode: this.orderList[0].tenantId,
  193. statusFlag: "1"
  194. }]
  195. uni.setStorageSync('tenantInfo', tenant)
  196. }
  197. this.qrCode = options ? options.qrCode : ''
  198. this.location = options && options.location ? JSON.parse(options.location) : {}
  199. },
  200. destroyed() {
  201. console.log("关闭");
  202. },
  203. methods: {
  204. confirm(){
  205. console.log(this.orderNumber,'-------------------');
  206. if(this.orderNumber==null||this.orderNumber==0){
  207. uni.showToast({
  208. title: '请输入下单量',
  209. //将值设置为 success 或者直接不用写icon这个参数
  210. icon: 'error',
  211. //显示持续时间为 2秒
  212. duration: 2000
  213. })
  214. return;
  215. }
  216. this.selectOrder(this.tempItem);
  217. this.orderNumberDialog = false
  218. },
  219. cancel(){
  220. this.orderNumberDialog = false
  221. },
  222. onOrderNumberFocus() {
  223. if (this.orderNumber == 0) {
  224. this.orderNumber = null
  225. }
  226. },
  227. //二维码弹窗
  228. drawQrcode(item) {
  229. this.currentOrder = item
  230. this.showQrcode = true
  231. console.log(this.$refs.ordercode);
  232. setTimeout(() => {
  233. this.$refs.ordercode.make()
  234. }, 100)
  235. },
  236. selectOrder(item) {
  237. this.tempItem=item;
  238. this.$refs.loadingToast.show({
  239. type: "loading",
  240. message: this.$t('base.common.loading'),
  241. duration: "1000000"
  242. })
  243. console.log("选择到订单ID、", item);
  244. console.log("获取到二维码信息、", this.qrCode);
  245. if(item.orderType==5&&(this.orderNumber==0||this.orderNumber==null)){
  246. this.orderNumberDialog=true;
  247. this.$refs.loadingToast.hide()
  248. return;
  249. }
  250. if (this.qrCode) {
  251. let data = {
  252. orderId: item.id,
  253. orderType: item.orderType,
  254. vehicleSourceId: item.vehicleSourceId,
  255. vehicle:item.vehicle,
  256. qrCode: this.qrCode,
  257. orderNumber:this.orderNumber,
  258. }
  259. sendHandleOrder(data).then(res => {
  260. this.$refs.loadingToast.hide()
  261. console.log('扫码返回信息、', res.data);
  262. if (res.statusCode == 200) {
  263. uni.showModal({
  264. content: res.data.msg,
  265. showCancel: false,
  266. confirmText: this.$t("base.button.confirm"),
  267. success: function(res) {
  268. if (res.confirm) {
  269. setTimeout(() => {
  270. uni.navigateBack({
  271. delta: 1
  272. })
  273. }, 500)
  274. }
  275. }
  276. })
  277. }
  278. }).catch(() => {
  279. this.$refs.loadingToast.hide()
  280. })
  281. } else {
  282. this.$refs.loadingToast.hide()
  283. }
  284. },
  285. onMixedOrderClick(item) {
  286. uni.navigateTo({
  287. url: `/subpages/order/mixed?orderId=${item.id}&tenantId=${item.tenantId}`
  288. })
  289. }
  290. },
  291. };
  292. </script>
  293. <style></style>
  294. <style lang="scss" scoped>
  295. .address-text {
  296. font-size: 12px;
  297. color: #999;
  298. text-align: center;
  299. width: 100%;
  300. left: 0;
  301. line-height: 48rpx;
  302. background: #fff;
  303. }
  304. </style>
  305. <style>
  306. /* #ifndef APP-NVUE */
  307. page {
  308. background-color: #f5f7fa;
  309. }
  310. /* #endif */
  311. </style>
  312. <style lang="scss" scoped>
  313. @import '../../common/css/public.scss';
  314. /deep/.u-sticky{
  315. height: 50rpx !important
  316. }
  317. .fixed {
  318. position: relative;
  319. }
  320. .monitor-info {
  321. position: sticky;
  322. display: flex;
  323. justify-content: center;
  324. top: 52rpx;
  325. height:70rpx;
  326. z-index: 100;
  327. }
  328. .monitor-window {
  329. position: relative;
  330. width: 50%;
  331. }
  332. </style>