enter.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. wx.hideLoading();
  101. }, 1000);
  102. } else {
  103. var indx=e.currentTarget.dataset.indx;
  104. var datainfo= that.data.datainfo
  105. datainfo.splice(indx,1);
  106. that.setData({
  107. datainfo:datainfo
  108. })
  109. wx.hideLoading();
  110. wx.showLoading({
  111. title: res.message.msg,
  112. })
  113. setTimeout(function () {
  114. this.getsorting();
  115. wx.hideLoading();
  116. }, 1000);
  117. }
  118. }).catch(function (err) {
  119. console.log(222);
  120. })
  121. },
  122. click(e){
  123. wx.setClipboardData({
  124. data: e.currentTarget.dataset.no,
  125. success (res) {
  126. wx.showLoading({
  127. title: '复制成功',
  128. })
  129. }
  130. })
  131. },
  132. copy(e){
  133. console.log(e)
  134. var that = this;
  135. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/CopySave", {
  136. id: e.currentTarget.dataset.id,
  137. }, "post").then(function (res) {
  138. console.log(res);
  139. if (res.code != 200) {
  140. wx.showLoading({
  141. title: res.message.msg,
  142. })
  143. setTimeout(function () {
  144. wx.hideLoading();
  145. }, 1000);
  146. } else {
  147. wx.hideLoading();
  148. this.getsorting();
  149. }
  150. }).catch(function (err) {
  151. console.log(222);
  152. })
  153. },
  154. getOrder(e){
  155. console.log(e)
  156. var that = this;
  157. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/OrderReport", {
  158. order_id: that.data.order_id,
  159. }, "get").then(function (res) {
  160. console.log(res);
  161. if (res.code != 200) {
  162. wx.showLoading({
  163. title: res.message.msg,
  164. })
  165. setTimeout(function () {
  166. wx.hideLoading();
  167. }, 1000);
  168. } else {
  169. let order=res.message.data
  170. wx.hideLoading();
  171. that.setData({
  172. order
  173. })
  174. }
  175. }).catch(function (err) {
  176. console.log(222);
  177. })
  178. },
  179. submit(e){
  180. var that = this;
  181. app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/submit", {
  182. seal_no: this.data.seal_no,
  183. }, "post").then(function (res) {
  184. console.log(res);
  185. if (res.code != 200) {
  186. wx.showLoading({
  187. title: res.message.msg,
  188. })
  189. setTimeout(function () {
  190. wx.hideLoading();
  191. }, 1000);
  192. } else {
  193. wx.hideLoading();
  194. wx.showLoading({
  195. title: res.message.msg,
  196. })
  197. setTimeout(function () {
  198. wx.hideLoading();
  199. wx.navigateBack({
  200. delta: 1 //想要返回的层级
  201. })
  202. }, 1000);
  203. }
  204. }).catch(function (err) {
  205. console.log(222);
  206. })
  207. },
  208. coll(e){
  209. wx.makePhoneCall({
  210. phoneNumber: e.currentTarget.dataset.phone,
  211. })
  212. }
  213. })