enter.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. // pages/sorting/enter/enter.js
  2. const app =getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. seal_no:"",
  9. user_remark:"",
  10. y_good_count:"",
  11. s_good_count:"",
  12. pj_count:"",
  13. standards:"",
  14. datainfo:[],
  15. phone:'',
  16. order_id:"ws20220307185258297291",
  17. str:[
  18. {title:'不加工',color:'#F23131',url:'/image/icon/error-red.png',bg:"background: #FFE1E1;"},
  19. {title:'加工',color:'#0F8800',url:'/image/control/success.png',bg:"background: #EBF4EA;"},
  20. {title:'需确认',color:'#6A2A17',url:'/image/icon/icon_xuqueren@3x.png',bg:"background: #FFE5DD;"}
  21. ],
  22. show:false,
  23. isfen:0
  24. },
  25. onPullDownRefresh:function(){
  26. this.getsorting();
  27. },
  28. /**
  29. * 生命周期函数--监听页面加载
  30. */
  31. onLoad: function (options) {
  32. this.data.seal_no=options.seal_no;
  33. this.data.isfen=options.type;
  34. //this.getsorting();
  35. },
  36. onShow(){
  37. this.getsorting();
  38. },
  39. show(){
  40. this.getOrder();
  41. this.setData({
  42. show:!this.data.show
  43. })
  44. },
  45. onClose(){
  46. this.setData({
  47. show:!this.data.show
  48. })
  49. },
  50. toResult(){
  51. // this.submit();
  52. wx.navigateTo({
  53. url: '/pages/sorting/add/add?seal_no='+this.data.seal_no,
  54. })
  55. },
  56. getsorting(){
  57. var that = this;
  58. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry", {
  59. seal_no: this.data.seal_no
  60. }, "get").then(function (res) {
  61. console.log(res);
  62. if (res.code != 200) {
  63. wx.showLoading({
  64. title: res.message.msg,
  65. })
  66. setTimeout(function () {
  67. wx.hideLoading();
  68. }, 1000);
  69. } else {
  70. wx.hideLoading();
  71. var data = res.message.data
  72. that.setData({
  73. datainfo:data.data,
  74. user_remark:res.message.user_remark,
  75. y_good_count:res.message.y_good_count,
  76. s_good_count:res.message.s_good_count,
  77. seal_no:res.message.seal_no,
  78. pj_count:res.message.pj_count,
  79. standards:res.message.standards,
  80. phone:res.message.phone,
  81. order_id:res.message.order_id
  82. })
  83. }
  84. }).catch(function (err) {
  85. console.log(222);
  86. })
  87. },
  88. delete(e){
  89. console.log(e)
  90. var that = this;
  91. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/delete", {
  92. id: e.currentTarget.dataset.id,
  93. }, "delete").then(function (res) {
  94. console.log(res);
  95. if (res.code != 200) {
  96. wx.showLoading({
  97. title: res.message.msg,
  98. })
  99. setTimeout(function () {
  100. that.getsorting();
  101. wx.hideLoading();
  102. }, 1000);
  103. } else {
  104. var indx=e.currentTarget.dataset.indx;
  105. var datainfo= that.data.datainfo
  106. datainfo.splice(indx,1);
  107. that.setData({
  108. datainfo:datainfo
  109. })
  110. wx.hideLoading();
  111. wx.showLoading({
  112. title: res.message.msg,
  113. })
  114. setTimeout(function () {
  115. this.getsorting();
  116. wx.hideLoading();
  117. }, 1000);
  118. }
  119. }).catch(function (err) {
  120. console.log(222);
  121. })
  122. },
  123. click(e){
  124. wx.setClipboardData({
  125. data: e.currentTarget.dataset.no,
  126. success (res) {
  127. wx.showLoading({
  128. title: '复制成功',
  129. })
  130. }
  131. })
  132. },
  133. copy(e){
  134. console.log(e)
  135. var that = this;
  136. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/CopySave", {
  137. id: e.currentTarget.dataset.id,
  138. }, "post").then(function (res) {
  139. console.log(res);
  140. if (res.code != 200) {
  141. wx.showLoading({
  142. title: res.message.msg,
  143. })
  144. setTimeout(function () {
  145. wx.hideLoading();
  146. }, 1000);
  147. } else {
  148. wx.hideLoading();
  149. this.getsorting();
  150. }
  151. }).catch(function (err) {
  152. console.log(222);
  153. })
  154. },
  155. getOrder(e){
  156. console.log(e)
  157. var that = this;
  158. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/OrderReport", {
  159. order_id: that.data.order_id,
  160. }, "get").then(function (res) {
  161. console.log(res);
  162. if (res.code != 200) {
  163. wx.showLoading({
  164. title: res.message.msg,
  165. })
  166. setTimeout(function () {
  167. wx.hideLoading();
  168. }, 1000);
  169. } else {
  170. let order=res.message.data
  171. wx.hideLoading();
  172. that.setData({
  173. order
  174. })
  175. }
  176. }).catch(function (err) {
  177. console.log(222);
  178. })
  179. },
  180. submit(e){
  181. var that = this;
  182. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/submit", {
  183. seal_no: this.data.seal_no,
  184. }, "post").then(function (res) {
  185. console.log(res);
  186. if (res.code != 200) {
  187. wx.showLoading({
  188. title: res.message.msg,
  189. })
  190. setTimeout(function () {
  191. wx.hideLoading();
  192. }, 1000);
  193. } else {
  194. wx.hideLoading();
  195. wx.showLoading({
  196. title: res.message.msg,
  197. })
  198. setTimeout(function () {
  199. wx.hideLoading();
  200. // wx.navigateBack({
  201. // delta: 1 //想要返回的层级
  202. // })
  203. wx.navigateTo({
  204. url: '/pages/sorting/enternext/enternext?status='+res.message.data.status+'&id='+res.message.data.id,
  205. })
  206. }, 500);
  207. }
  208. }).catch(function (err) {
  209. console.log(222);
  210. })
  211. },
  212. coll(e){
  213. wx.makePhoneCall({
  214. phoneNumber: e.currentTarget.dataset.phone,
  215. })
  216. }
  217. })