transfer.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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%;">
  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.id"></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>
  52. <view style="width: 100%;height: 120rpx;"></view>
  53. <view class="card_btn">
  54. <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. checked: [],
  63. list: [],
  64. current: null,
  65. assignerFlag: false,
  66. assignerData: [],
  67. flowStep: [{
  68. id: '13',
  69. title: '气站确认空瓶到达气站'
  70. }, {
  71. id: '016',
  72. title: '气站确认重瓶到达气站'
  73. }, {
  74. id: '17',
  75. title: '司机确认重瓶从气站出库'
  76. }, {
  77. id: '11',
  78. title: '司机确认空瓶装车'
  79. }, {
  80. id: '033',
  81. title: '司机确认空瓶从门店出库'
  82. }, {
  83. id: '31',
  84. title: '门店确认重瓶卸货入库'
  85. }, {
  86. id: '35',
  87. title: '门店确认未配送重瓶返库'
  88. }, {
  89. id: '21',
  90. title: '门店回收空瓶'
  91. }, {
  92. id: '25',
  93. title: '送气员重瓶出库'
  94. }]
  95. }
  96. },
  97. onLoad(value) {
  98. this.current = value.status
  99. },
  100. mounted() {
  101. this.getList()
  102. },
  103. methods: {
  104. // 获取列表
  105. getList() {
  106. this.$api.get('/api/gas-cylinder-status', {
  107. status: this.current,
  108. }).then(res => {
  109. if (res.code == 200) {
  110. this.list = res.data.list
  111. }
  112. })
  113. },
  114. // 调拨提交
  115. submit() {
  116. },
  117. // 扫一扫
  118. allotSweep() {
  119. // 允许从相机和相册扫码
  120. uni.scanCode({
  121. scanType: ['qrCode'],
  122. autoZoom: false,
  123. success: (res) => {
  124. console.log(res, '--------');
  125. if (res.result) {
  126. let url = res.result;
  127. function getCharactersBefore(str, char) {
  128. const index = str.indexOf(char);
  129. if (index > -1) {
  130. return str.substring(0, index);
  131. }
  132. return ''; // 如果字符不存在,返回空字符串
  133. }
  134. const title = getCharactersBefore(url, '?');
  135. if (title == 'dialCode') {
  136. this.assignerFlag = true
  137. function getCharactersBefore1(str, char) {
  138. const index = str.indexOf(char);
  139. if (index > -1) {
  140. return str.substring(index + 1);
  141. }
  142. return ''; // 如果字符不存在,返回空字符串
  143. }
  144. const arr = getCharactersBefore1(url, '?')
  145. this.assignerData = arr.split(',')
  146. }
  147. } else {
  148. console.log('请重新扫描');
  149. return false;
  150. }
  151. },
  152. fail: (res) => {
  153. console.log('未识别到二维码1');
  154. }
  155. })
  156. },
  157. // 流转步骤文字
  158. getflowStep(value) {
  159. let title = ''
  160. this.flowStep.forEach(item => {
  161. if (item.id == value[0]) {
  162. title = item.title
  163. }
  164. })
  165. return title
  166. },
  167. // 输入第几个
  168. howMany(value) {
  169. const result = this.list.slice(0, value)
  170. this.checked = []
  171. result.forEach(item => {
  172. this.checked.push(item.id)
  173. })
  174. },
  175. // 全选
  176. checkAll() {
  177. this.checked = []
  178. this.list.forEach(item => {
  179. this.checked.push(item.id)
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .card_transfer {
  187. padding: 0rpx 30rpx;
  188. }
  189. .card_avatar {
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. }
  194. .mine_image {
  195. width: 100rpx;
  196. height: 100rpx;
  197. border-radius: 50%;
  198. }
  199. .card_user_title {
  200. display: flex;
  201. flex-direction: column;
  202. align-items: flex-start;
  203. }
  204. .mine_phone {
  205. margin-left: 20rpx;
  206. font-size: 30rpx;
  207. }
  208. .card_assigner_aaf {
  209. margin-top: 20rpx;
  210. padding: 30rpx;
  211. border: 1rpx dashed #d7d7d7;
  212. }
  213. .step_title {
  214. font-size: 34rpx;
  215. font-weight: 600;
  216. }
  217. .flow_step_title {
  218. font-size: 30rpx;
  219. margin: 20rpx 0rpx;
  220. }
  221. .tran_title {
  222. font-size: 36rpx;
  223. font-weight: 600;
  224. }
  225. .cylinder_ccsfs {
  226. margin-top: 30rpx;
  227. padding-bottom: 20rpx;
  228. border-bottom: 1rpx solid #d7d7d7;
  229. }
  230. .blue_title {
  231. color: #2979ff;
  232. }
  233. .card_right_num {
  234. margin-left: 40rpx;
  235. display: flex;
  236. align-items: center;
  237. }
  238. .num_card {
  239. margin: 0rpx 8rpx;
  240. width: 60rpx;
  241. }
  242. .input_taaf {
  243. padding: 0rpx !important;
  244. }
  245. .card_dinay {
  246. display: flex;
  247. align-items: center;
  248. width: calc(100% - 40rpx);
  249. border-bottom: 1rpx solid #d7d7d7;
  250. padding: 30rpx 20rpx;
  251. }
  252. .item_current {
  253. width: 40rpx;
  254. color: #82848a;
  255. }
  256. .item_title1 {
  257. margin-left: 10rpx;
  258. }
  259. .card_btn {
  260. position: fixed;
  261. left: 0;
  262. right: 0;
  263. bottom: 0;
  264. padding-left: 30rpx;
  265. padding-right: 30rpx;
  266. padding-top: 20rpx;
  267. background-color: #fff;
  268. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  269. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  270. }
  271. </style>