confirmOreder.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // pages/order/confirmOreder/confirmOreder.js
  2. const app=getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. currentList: [{
  9. tit: '塑封包膜',
  10. num: "30",
  11. id:1
  12. }, {
  13. tit: '绒面鞋补色',
  14. num: "20",
  15. id:2
  16. }, {
  17. tit: '防水处理',
  18. num: "20",
  19. id:3
  20. }, {
  21. tit: '防水处理',
  22. num: "10",
  23. id:4
  24. }],
  25. mode:true,
  26. checked:false,
  27. show1:false,
  28. show2:false,
  29. code:""
  30. },
  31. onLoad() {
  32. let currentList = this.data.currentList
  33. currentList.map(item => {
  34. item.active = false
  35. })
  36. this.setData({
  37. currentList
  38. })
  39. },
  40. changeClose1(e){
  41. this.setData({
  42. show1:!this.data.show1
  43. })
  44. },
  45. changeClose2(e){
  46. this.setData({
  47. show2:!this.data.show2
  48. })
  49. },
  50. onChange(event) {
  51. console.log(event);
  52. this.setData({
  53. checked: event.detail,
  54. });
  55. },
  56. chios(e){
  57. let {item} = e.currentTarget.dataset
  58. let currentList = this.data.currentList
  59. currentList.map((it,index)=>{
  60. if (item.id == it.id) {
  61. it.active = !it.active
  62. }
  63. })
  64. this.setData({
  65. currentList
  66. })
  67. },
  68. changeMode(e){
  69. let {mode} = e.currentTarget.dataset
  70. this.setData({
  71. mode
  72. })
  73. },
  74. goto(){
  75. wx.navigateTo({
  76. url:'/pages/my/cashier/cashier'
  77. })
  78. },
  79. getPhoneNumber (e){
  80. app.login();
  81. console.log(e)
  82. var data={
  83. 'mds':wx.getStorageSync('seisson_key'),
  84. 'encryptedData':e.detail.encryptedData,
  85. 'errMsg':e.detail.errMsg,
  86. 'iv':e.detail.iv,
  87. 'appid':wx.getAppBaseInfo().host.appId,
  88. 'token':wx.getStorageSync('token')
  89. }
  90. wx.cloud.callFunction({
  91. name: 'getPhoneNumber',
  92. data:{
  93. 'message':data
  94. },
  95. success:res=>{
  96. console.log(res)
  97. var par=res.result.original;
  98. if(par.code==200){
  99. var phone=par.message.data.phone
  100. if(phone){
  101. this.setData({
  102. code: phone,
  103. })
  104. }
  105. }
  106. },
  107. fail:err=>{
  108. console.log(err)
  109. }
  110. })
  111. // console.log("fetch cloudfunction success", cloudResult.result)
  112. }
  113. })