transfer.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <!-- 调拨钢瓶 -->
  3. <view>
  4. <u-navbar title="钢瓶调拨" autoBack placeholder></u-navbar>
  5. <view class="card_transfer">
  6. <view style="display: flex;align-items: center;" @click="allotSweep">
  7. <view class="tran_title">1.扫描调拨码</view>
  8. <u-icon name="scan" size="30"></u-icon>
  9. </view>
  10. <view class="card_assigner_aaf" v-if="assignerFlag">
  11. <view class="step_title">流转步骤</view>
  12. <view class="flow_step_title">{{ getflowStep(assignerData) }}</view>
  13. <view class="card_avatar">
  14. <view style="display: flex;align-items: center;">
  15. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  16. <view class="card_user_title">
  17. <view class="mine_phone">{{assignerData[2]}}</view>
  18. <view class="mine_phone">{{assignerData[4]}}</view>
  19. </view>
  20. </view>
  21. <view>调拨人</view>
  22. </view>
  23. </view>
  24. <view class="space_between cylinder_ccsfs">
  25. <view class="tran_title">2.钢瓶编号</view>
  26. <view style="display: flex;align-items: center;">
  27. <view class="blue_title" @click="checkAll">全选</view>
  28. <view class="card_right_num">
  29. <span class="blue_title">选择前</span>
  30. <view class="num_card">
  31. <u--input class="input_taaf" type="number" fontSize="12" inputAlign="center"
  32. border="surround" @blur="howMany"></u--input>
  33. </view>
  34. <span class="blue_title">个</span>
  35. </view>
  36. </view>
  37. </view>
  38. <view style="width: 100%;" v-if="list.length > 0">
  39. <u-checkbox-group v-model="checked">
  40. <view style="width: 100%;display: flex;flex-direction: column;">
  41. <view class="card_dinay" v-for="(item,index) in list" :key="index">
  42. <u-checkbox :name="item.inner_code"></u-checkbox>
  43. <view style="display: flex;align-items: center;margin-left: 20rpx;">
  44. <view class="item_current">{{index + 1}}</view>
  45. <view class="item_title1">{{item.inner_code}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. </u-checkbox-group>
  50. </view>
  51. <view style="margin-top: 20%;" v-else>
  52. <u-empty mode="list" text="暂无钢瓶"></u-empty>
  53. </view>
  54. </view>
  55. <view style="width: 100%;height: 120rpx;"></view>
  56. <view class="card_btn">
  57. <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. checked: [],
  66. list: [],
  67. current: null,
  68. assignerFlag: false,
  69. assignerData: [],
  70. flowStep: [{
  71. id: '13',
  72. title: '气站确认空瓶到达气站'
  73. }, {
  74. id: '016',
  75. title: '气站确认重瓶到达气站'
  76. }, {
  77. id: '17',
  78. title: '司机确认重瓶从气站出库'
  79. }, {
  80. id: '11',
  81. title: '司机确认空瓶装车'
  82. }, {
  83. id: '033',
  84. title: '司机确认空瓶从门店出库'
  85. }, {
  86. id: '31',
  87. title: '门店确认重瓶卸货入库'
  88. }, {
  89. id: '35',
  90. title: '门店确认未配送重瓶返库'
  91. }, {
  92. id: '21',
  93. title: '门店回收空瓶'
  94. }, {
  95. id: '25',
  96. title: '送气员重瓶出库'
  97. }, {
  98. id: 'Unqualified',
  99. title: '回收不合格钢瓶'
  100. }],
  101. Pagination: {
  102. PageIndex: 1,
  103. PageSize: 20,
  104. Total: 0,
  105. },
  106. loadingMore: true,
  107. }
  108. },
  109. onReachBottom() {
  110. if (!this.loadingMore) {
  111. this.getList()
  112. }
  113. },
  114. onLoad(value) {
  115. this.current = value.status
  116. },
  117. mounted() {
  118. this.getList()
  119. },
  120. methods: {
  121. // 获取列表
  122. getList() {
  123. this.loadingMore = true
  124. this.$api.get('/api/gas-cylinder-status', {
  125. page: this.Pagination.PageIndex,
  126. pageSize: this.Pagination.PageSize,
  127. status: this.current,
  128. }).then(res => {
  129. if (res.code == 200) {
  130. const data = res.data.list
  131. if (this.loadingMore == true && data) {
  132. this.list = this.list.concat(data);
  133. }
  134. if (data.length < this.Pagination.PageSize) {
  135. this.loadingMore = true
  136. } else {
  137. this.loadingMore = false
  138. this.Pagination.PageIndex++
  139. }
  140. }
  141. })
  142. },
  143. // 调拨提交
  144. submit() {
  145. if (this.assignerData.length > 0) {
  146. if (this.checked.length > 0) {
  147. this.$api.post('/api/gas-cylinder-allot', {
  148. optType: this.assignerData[0],
  149. acceptUserId: Number(this.assignerData[1]),
  150. acceptCompanyId: Number(this.assignerData[3]),
  151. innerCodeList: this.checked,
  152. gasCylinderStatus: this.current,
  153. }).then(res => {
  154. if (res.code == 200) {
  155. this.loadingMore = true
  156. this.Pagination.PageIndex = 1
  157. this.list = []
  158. this.getList()
  159. this.checked = []
  160. uni.$u.toast(res.msg)
  161. } else {
  162. uni.$u.toast(res.data.msg)
  163. }
  164. this.$forceUpdate()
  165. })
  166. } else {
  167. uni.$u.toast('请先选择调拨钢瓶')
  168. }
  169. } else {
  170. uni.$u.toast('请先扫描调拨码')
  171. }
  172. },
  173. // 扫一扫
  174. allotSweep() {
  175. // 允许从相机和相册扫码
  176. uni.scanCode({
  177. scanType: ['qrCode'],
  178. autoZoom: false,
  179. success: (res) => {
  180. console.log(res, '--------');
  181. if (res.result) {
  182. let url = res.result;
  183. function getCharactersBefore(str, char) {
  184. const index = str.indexOf(char);
  185. if (index > -1) {
  186. return str.substring(0, index);
  187. }
  188. return ''; // 如果字符不存在,返回空字符串
  189. }
  190. const title = getCharactersBefore(url, '?');
  191. if (title == 'dialCode') {
  192. this.assignerFlag = true
  193. function getCharactersBefore1(str, char) {
  194. const index = str.indexOf(char);
  195. if (index > -1) {
  196. return str.substring(index + 1);
  197. }
  198. return ''; // 如果字符不存在,返回空字符串
  199. }
  200. const arr = getCharactersBefore1(url, '?')
  201. this.assignerData = arr.split(',')
  202. }
  203. } else {
  204. console.log('请重新扫描');
  205. return false;
  206. }
  207. },
  208. fail: (res) => {
  209. console.log('未识别到二维码1');
  210. }
  211. })
  212. },
  213. // 流转步骤文字
  214. getflowStep(value) {
  215. let title = ''
  216. this.flowStep.forEach(item => {
  217. if (item.id == value[0]) {
  218. title = item.title
  219. }
  220. })
  221. return title
  222. },
  223. // 输入第几个
  224. howMany(value) {
  225. const result = this.list.slice(0, value)
  226. this.checked = []
  227. result.forEach(item => {
  228. this.checked.push(item.inner_code)
  229. })
  230. this.$forceUpdate()
  231. },
  232. // 全选
  233. checkAll() {
  234. this.checked = []
  235. this.list.forEach(item => {
  236. this.checked.push(item.inner_code)
  237. })
  238. this.$forceUpdate()
  239. }
  240. }
  241. }
  242. </script>
  243. <style lang="scss">
  244. .card_transfer {
  245. padding: 0rpx 30rpx;
  246. }
  247. .card_avatar {
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-between;
  251. }
  252. .mine_image {
  253. width: 100rpx;
  254. height: 100rpx;
  255. border-radius: 50%;
  256. }
  257. .card_user_title {
  258. display: flex;
  259. flex-direction: column;
  260. align-items: flex-start;
  261. }
  262. .mine_phone {
  263. margin-left: 20rpx;
  264. font-size: 30rpx;
  265. }
  266. .card_assigner_aaf {
  267. margin-top: 20rpx;
  268. padding: 30rpx;
  269. border: 1rpx dashed #d7d7d7;
  270. }
  271. .step_title {
  272. font-size: 34rpx;
  273. font-weight: 600;
  274. }
  275. .flow_step_title {
  276. font-size: 30rpx;
  277. margin: 20rpx 0rpx;
  278. }
  279. .tran_title {
  280. font-size: 36rpx;
  281. font-weight: 600;
  282. }
  283. .cylinder_ccsfs {
  284. margin-top: 30rpx;
  285. padding-bottom: 20rpx;
  286. border-bottom: 1rpx solid #d7d7d7;
  287. }
  288. .blue_title {
  289. color: #2979ff;
  290. }
  291. .card_right_num {
  292. margin-left: 40rpx;
  293. display: flex;
  294. align-items: center;
  295. }
  296. .num_card {
  297. margin: 0rpx 8rpx;
  298. width: 60rpx;
  299. }
  300. .input_taaf {
  301. padding: 0rpx !important;
  302. }
  303. .card_dinay {
  304. display: flex;
  305. align-items: center;
  306. width: calc(100% - 40rpx);
  307. border-bottom: 1rpx solid #d7d7d7;
  308. padding: 30rpx 20rpx;
  309. }
  310. .item_current {
  311. width: 40rpx;
  312. color: #82848a;
  313. }
  314. .item_title1 {
  315. margin-left: 10rpx;
  316. }
  317. .card_btn {
  318. position: fixed;
  319. left: 0;
  320. right: 0;
  321. bottom: 0;
  322. padding-left: 30rpx;
  323. padding-right: 30rpx;
  324. padding-top: 20rpx;
  325. background-color: #fff;
  326. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  327. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  328. }
  329. </style>