print.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view>
  3. <uni-list :border="false">
  4. <uni-list-item v-for="(item,index) in breedTaskList" :key="item.id" :index="index" :threshold="0">
  5. <template slot="body">
  6. <uni-card :title="item.printBill.billCode" :subTitle="item.printBreed.breedName" :extra="parseBreedTaskStatus(item)">
  7. <view class="uni-body">
  8. <view>
  9. <text class="textTitle">印品名称</text>
  10. <text class="">{{item.printBill.billName}}</text>
  11. </view>
  12. <view v-show="item.showMore == true">
  13. <view>
  14. <text class="textTitle">印刷要求</text>
  15. <text class="">{{item.printBreed.printRequire | ignoreNull}}</text>
  16. </view>
  17. <view>
  18. <text class="textTitle">客户名称</text>
  19. <text class="">{{item.printBill.clientName}}</text>
  20. </view>
  21. <view>
  22. <text class="textTitle">产品类型</text>
  23. <text class="">{{item.printBill.productName}}</text>
  24. </view>
  25. <view>
  26. <text class="textTitle">用纸</text>
  27. <text class="">{{item.printBreed.actualPaperName | ignoreNull}}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <view slot="actions" class="card-actions">
  32. <view class="card-actions-item" @click="viewBreedTaskMore(item)">
  33. <uni-icons v-if="item.showMore == false" type="bottom" size="18" color="#999"></uni-icons>
  34. <uni-icons v-if="item.showMore == true" type="top" size="18" color="#999"></uni-icons>
  35. <text class="card-actions-item-text" v-if="item.showMore == false">展开</text>
  36. <text class="card-actions-item-text" v-if="item.showMore == true">折叠</text>
  37. </view>
  38. <view class="card-actions-item" @click="viewBreedTaskDetail(item)">
  39. <uni-icons type="info-filled" size="18" color="#999"></uni-icons>
  40. <text class="card-actions-item-text">详情</text>
  41. </view>
  42. <view class="card-actions-item" @click="viewBreedTaskStep(item)">
  43. <uni-icons type="tune" size="18" color="#999"></uni-icons>
  44. <text class="card-actions-item-text">脚印</text>
  45. </view>
  46. <view class="card-actions-item" @click="feedBack(item)">
  47. <uni-icons type="compose" size="18" color="#999"></uni-icons>
  48. <text class="card-actions-item-text">反馈</text>
  49. </view>
  50. </view>
  51. </uni-card>
  52. </template>
  53. </uni-list-item>
  54. </uni-list>
  55. <!-- <view v-show="isLoadMore">
  56. <uni-load-more :status="loadStatus" showIcon @clickLoadMore="loadMoreBill()"></uni-load-more>
  57. </view> -->
  58. <u-popup :show="feedBackPopupShow" :overlay="true" mode="bottom" :closeable="true" :closeOnClickOverlay="true"
  59. @close="feedBackPopupClose">
  60. <view class="u-popup-slot">
  61. <uni-section
  62. :title="focuseTask.printBill.billCode + '(' + focuseTask.printBreed.breedName + ')'"
  63. type="line"></uni-section>
  64. <view>
  65. <uni-forms ref="feedBackForm">
  66. <uni-forms-item label="是否完成" required name="feedBackComplete">
  67. <uni-data-checkbox v-model="feedBackData.feedBackComplete" :multiple="true" :localdata="feedBackCompleteStatus" />
  68. </uni-forms-item>
  69. <uni-forms-item label="反馈数量" required name="feedBackCount">
  70. <uni-easyinput type="number" v-model="feedBackData.feedBackCount"
  71. placeholder="请输入数量" />
  72. </uni-forms-item>
  73. <uni-forms-item label="反馈备注" name="feedBackMemo">
  74. <uni-easyinput type="textarea" v-model="feedBackData.feedBackMemo" placeholder="请输入备注" />
  75. </uni-forms-item>
  76. </uni-forms>
  77. <button type="primary" @click="submitFeedBackForm('feedBackForm')">提交</button>
  78. </view>
  79. </view>
  80. </u-popup>
  81. <view class="footer">
  82. <view>
  83. <view>
  84. <text class="footer-text">总数:18</text><br>
  85. <text style="margin-top: -10rpx;" class="footer-text">包数:26</text>
  86. </view>
  87. </view>
  88. <view @click="confirmOrderCodes">确认交接</view>
  89. </view>
  90. <uni-fab style="bottom: 100rpx;" ref="fab" :pattern="fabPattern" icon="scan" :popMenu="false" horizontal="right" vertical="bottom"
  91. @fabClick="scanFabClick" />
  92. </view>
  93. </template>
  94. <script>
  95. import request from '@/common/libs/request.js';
  96. export default {
  97. data() {
  98. return {
  99. fabPattern: {
  100. color: '#7A7E83',
  101. backgroundColor: '#fff',
  102. selectedColor: '#007AFF',
  103. buttonColor: '#007AFF',
  104. iconColor: '#fff'
  105. },
  106. idMachineInfo: 0,
  107. breedTaskList: [],
  108. feedBackPopupShow: false,
  109. focuseTask: {
  110. printBill:{},
  111. printBreed:{}
  112. },
  113. feedBackData: {
  114. feedBackCount: 0,
  115. feedBackComplete:[1],
  116. feedBackMemo: ''
  117. },
  118. feedBackCompleteStatus:[
  119. {
  120. text: '任务已完成',
  121. value: 1
  122. }
  123. ]
  124. }
  125. },
  126. onLoad() {
  127. // if (process.env.NODE_ENV === 'development') {
  128. // this.fillBreedTaskByMachine(2, 1);
  129. // }
  130. },
  131. methods: {
  132. confirmOrderCodes(){
  133. },
  134. searchPrintBreed() {
  135. },
  136. scanFabClick() {
  137. let _that = this;
  138. uni.scanCode({
  139. onlyFromCamera: true,
  140. scanType: ['barCode', 'qrCode'],
  141. success: function(res) {
  142. if (res.result.match(new RegExp("^machine.*$"))) {
  143. let idMachine = res.result.split("-")[1];
  144. _that.idMachineInfo = idMachine;
  145. _that.fillBreedTaskByMachine(idMachine, 1);
  146. } else if (res.result.match(new RegExp("^printbill.*$"))) {
  147. }
  148. }
  149. })
  150. },
  151. fillBreedTaskByMachine(idMachine, pageIndex) {
  152. let _that = this;
  153. let listData = {
  154. params: JSON.stringify({
  155. idProcess: 5,
  156. idMachineInfo: idMachine,
  157. keyWord: ""
  158. }),
  159. page: JSON.stringify({
  160. pageIndex: pageIndex,
  161. pageSize: 20
  162. })
  163. }
  164. request.httpPost("/printbill/queryBreedTasksToFeedback", listData, true).then(res => {
  165. if (res.httpCode == 200) {
  166. res.data.forEach(item => {
  167. item.showMore = false
  168. })
  169. _that.breedTaskList = res.data;
  170. }
  171. });
  172. },
  173. parseBreedTaskStatus(task) {
  174. if (task.pauseStatus == 0) {
  175. if (task.taskStatus == 0) {
  176. return "未开始";
  177. } else if (task.taskStatus == 1) {
  178. return "生产中";
  179. } else if (task.taskStatus == 2) {
  180. return "终止";
  181. } else if (task.taskStatus == 5) {
  182. return "完成";
  183. } else if (task.taskStatus == 10) {
  184. return "已完成";
  185. }
  186. } else {
  187. return "暂停";
  188. }
  189. },
  190. viewBreedTaskMore(task) {
  191. task.showMore = !task.showMore
  192. },
  193. feedBack(task) {
  194. let _that = this;
  195. _that.focuseTask = task;
  196. console.log(JSON.stringify(_that.feedBackData));
  197. if (task.taskStatus == 0) {
  198. //反馈开始
  199. uni.showModal({
  200. title: '印刷反馈',
  201. content: '是否反馈任务开始?',
  202. success: function (resConfirm) {
  203. if (resConfirm.confirm) {
  204. let postData = {
  205. item: JSON.stringify({
  206. idTask: task.id,
  207. taskStatus: 0,
  208. isComplete: true,
  209. feedbackCount: "",
  210. memo: ""
  211. })
  212. }
  213. request.httpPost("/printbill/feedbackTask", postData, true).then(resFeedBack => {
  214. if (resFeedBack.httpCode == 200) {
  215. task.taskStatus = 1;
  216. uni.showToast({
  217. title:"反馈成功"
  218. })
  219. } else {
  220. uni.showToast({
  221. title: resFeedBack.msg
  222. })
  223. }
  224. });
  225. } else if (resConfirm.cancel) {
  226. console.log('用户点击取消');
  227. }
  228. }
  229. });
  230. } else if (task.taskStatus == 1) {
  231. //反馈完成
  232. _that.feedBackPopupShow = true;
  233. }
  234. },
  235. feedBackPopupClose() {
  236. this.feedBackPopupShow = false;
  237. console.log(JSON.stringify(this.feedBackData));
  238. },
  239. submitFeedBackForm(ref) {
  240. let _that = this;
  241. let isComplete = true;
  242. if (_that.feedBackData.feedBackComplete.length == 0) {
  243. isComplete = false
  244. }
  245. let postData = {
  246. item: JSON.stringify({
  247. idTask: _that.focuseTask.id,
  248. taskStatus: 1,
  249. isComplete: isComplete,
  250. feedbackCount:_that.feedBackData.feedBackCount,
  251. memo: _that.feedBackData.feedBackMemo
  252. })
  253. }
  254. request.httpPost("/printbill/feedbackTask", postData, true).then(resFeedBack => {
  255. if (resFeedBack.httpCode == 200) {
  256. _that.focuseTask.taskStatus = 1;
  257. uni.showToast({
  258. title:"反馈成功"
  259. })
  260. } else {
  261. uni.showToast({
  262. title: resFeedBack.msg
  263. })
  264. }
  265. });
  266. },
  267. viewBreedTaskDetail(task) {
  268. uni.navigateTo({
  269. url: "../printbill/detail?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
  270. animationType: 'pop-in'
  271. })
  272. },
  273. viewBreedTaskStep(task) {
  274. uni.navigateTo({
  275. url: "../printbill/step?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
  276. animationType: 'pop-in'
  277. })
  278. }
  279. }
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. /deep/ .uni-list-item__container {
  284. padding: 0rpx;
  285. }
  286. .card-actions {
  287. display: flex;
  288. flex-direction: row;
  289. justify-content: space-around;
  290. align-items: center;
  291. height: 45px;
  292. border-top: 1px #eee solid;
  293. }
  294. .card-actions-item {
  295. display: flex;
  296. flex-direction: row;
  297. align-items: center;
  298. }
  299. .card-actions-item-text {
  300. font-size: 12px;
  301. color: #666;
  302. margin-left: 5px;
  303. }
  304. .textTitle {
  305. border-left: 0px solid #007AFF;
  306. display: inline-block;
  307. width: 180rpx;
  308. text-align: left;
  309. margin-bottom: 5px;
  310. color: #8799a3;
  311. }
  312. .u-popup-slot {
  313. width: 750rpx;
  314. height: 400px;
  315. @include flex;
  316. justify-content: center;
  317. align-items: center;
  318. padding: 20px;
  319. }
  320. .footer {
  321. position: fixed;
  322. bottom: 0;
  323. z-index: 10;
  324. display: flex;
  325. justify-content: space-between;
  326. width: 100%;
  327. height: 108rpx;
  328. background: #FFFFFF;
  329. border-top: 1px solid #E8E8E8;
  330. >view {
  331. width: 50%;
  332. height: 100%;
  333. font-size: 34rpx;
  334. font-weight: 600;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. &:active {
  339. opacity: 0.8;
  340. }
  341. .cart {
  342. width: 67rpx;
  343. height: 67rpx;
  344. margin-top: 10rpx;
  345. margin-right: 25rpx;
  346. }
  347. .amout {
  348. font-size: 34rpx;
  349. >text {
  350. font-size: 20rpx;
  351. }
  352. }
  353. .badge {
  354. position: relative;
  355. >text {
  356. position: absolute;
  357. top: 2rpx;
  358. right: 10rpx;
  359. z-index: 10;
  360. font-size: 22rpx;
  361. background: #FF3D00;
  362. border-radius: 50%;
  363. color: #fff;
  364. padding: 0 10rpx 2rpx;
  365. }
  366. }
  367. }
  368. >view:last-child {
  369. background: #FFD202;
  370. }
  371. }
  372. </style>