cannibalize.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view>
  3. <u-navbar :title="headTile" autoBack placeholder></u-navbar>
  4. <view class="card_cannibalize">
  5. <view class="card_erweima_af">
  6. <canvas id="qrcode" canvas-id="qrcode" style="width: 140px;height:140px;" />
  7. <view class="title_balize">调拨码</view>
  8. </view>
  9. <view v-if="transferFlag">
  10. <view class="subheading_title">调拨人</view>
  11. <view style="display: flex;align-items: center;">
  12. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  13. <view class="card_user_title">
  14. <view class="mine_phone" v-if="transferList.allotUser">{{transferList.allotUser.nickName}}
  15. </view>
  16. <view class="mine_phone" v-if="transferList.allotCompany">{{transferList.allotCompany.name}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="subheading_title1">钢瓶编号</view>
  21. <view class="card_innercode" v-for="(item1,index1) in transferList.innerCodeList" :key="index1">
  22. <view style="color: #82848a;">{{ index1 + 1 }}</view>
  23. <view class="title_innerCode">{{ item1 }}</view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="btn_cannibalize" v-if="transferFlag">
  28. <view style="flex: 1;">
  29. <u-button style="width: 80%;" type="error" @click="cancelAllocation">取消</u-button>
  30. </view>
  31. <view style="flex: 1;">
  32. <u-button style="width: 80%;" type="primary" @click="submit">确定</u-button>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import UQRCode from "static/js/uqrcode.js";
  39. export default {
  40. data() {
  41. return {
  42. orderId: '',
  43. headTile: '',
  44. transferList: {},
  45. transferFlag: false,
  46. }
  47. },
  48. onLoad(value) {
  49. this.orderId = value.type
  50. this.headTile = value.title
  51. },
  52. mounted() {
  53. var userInfo = this.$cache.getCache('userInfo')
  54. this.userInfo = userInfo
  55. const qr = new UQRCode();
  56. let numarr = 'dialCode?' + this.orderId + ',' + userInfo.id + ',' + userInfo.nickName + ',' + userInfo.dept
  57. .id + ',' +
  58. userInfo.dept.name + ','
  59. qr.data = numarr;
  60. qr.size = 140;
  61. qr.make();
  62. const ctx = uni.createCanvasContext('qrcode', this);
  63. qr.canvasContext = ctx;
  64. qr.drawCanvas();
  65. this.getallot()
  66. },
  67. methods: {
  68. getallot() {
  69. this.$api.get('/api/gas-cylinder-allot/opt-type/' + this.orderId).then(res => {
  70. if (res.code == 200) {
  71. this.transferFlag = true
  72. this.transferList = res.data
  73. } else {
  74. setTimeout(() => {
  75. this.getallot()
  76. }, 60000);
  77. }
  78. })
  79. },
  80. // 取消调拨
  81. cancelAllocation() {
  82. this.$api.post('/api/gas-cylinder-allot/cancel', {
  83. id: this.transferList.id,
  84. }).then(res => {
  85. if (res.code == 200) {
  86. this.transferFlag = false
  87. this.transferList = {}
  88. uni.$u.toast(res.msg)
  89. }
  90. })
  91. },
  92. // 确定调拨钢瓶
  93. submit() {
  94. this.$api.post('/api/gas-cylinder-allot/submit', {
  95. id: this.transferList.id,
  96. optType: this.transferList.optType,
  97. allotUserId: this.transferList.allotUserId,
  98. acceptUserId: this.transferList.acceptUserId,
  99. allotCompanyId: this.transferList.allotCompanyId,
  100. acceptCompanyId: this.transferList.acceptCompanyId,
  101. innerCodeList: this.transferList.innerCodeList,
  102. }).then(res => {
  103. if (res.code == 200) {
  104. this.transferFlag = false
  105. this.transferList = {}
  106. uni.$u.toast(res.msg)
  107. setTimeout(() => {
  108. uni.redirectTo({
  109. url: '/pages/indexRouter?page=1'
  110. });
  111. }, 1500)
  112. }
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. page {
  120. background-color: #f4f4f5;
  121. }
  122. .card_cannibalize {
  123. display: flex;
  124. flex-direction: column;
  125. background-color: #fff;
  126. margin: 30rpx;
  127. padding: 30rpx;
  128. border-radius: 10rpx;
  129. }
  130. .card_erweima_af {
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. flex-direction: column;
  135. }
  136. .title_balize {
  137. font-size: 40rpx;
  138. margin-top: 10rpx;
  139. font-weight: 600;
  140. }
  141. .mine_image {
  142. width: 100rpx;
  143. height: 100rpx;
  144. border-radius: 50%;
  145. }
  146. .card_user_title {
  147. display: flex;
  148. flex-direction: column;
  149. align-items: flex-start;
  150. }
  151. .mine_phone {
  152. margin-left: 20rpx;
  153. font-size: 30rpx;
  154. }
  155. .card_innercode {
  156. display: flex;
  157. padding: 20rpx;
  158. border-bottom: 1rpx solid #d7d7d7;
  159. }
  160. .subheading_title {
  161. font-size: 34rpx;
  162. font-weight: 600;
  163. margin: 20rpx 0rpx;
  164. }
  165. .subheading_title1 {
  166. font-size: 34rpx;
  167. font-weight: 600;
  168. margin-top: 20rpx;
  169. padding-bottom: 20rpx;
  170. border-bottom: 1rpx solid #d7d7d7;
  171. }
  172. .title_innerCode {
  173. font-size: 30rpx;
  174. margin-left: 10rpx;
  175. }
  176. .btn_cannibalize {
  177. position: fixed;
  178. bottom: 0;
  179. left: 0;
  180. right: 0;
  181. background-color: #fff;
  182. display: flex;
  183. align-items: center;
  184. padding: 20rpx 0rpx;
  185. }
  186. </style>