抖音b端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

147 righe
3.2 KiB

  1. // pages/getMerchant/index.js
  2. const config = require('../../config/config.js')
  3. const Http = require('../../utils/HttpBasics.js')
  4. const util = require('../../utils/util.js')
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. selectList:[],
  12. list: [],
  13. selectMerchant:null,
  14. businessId:''
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. this.setData({
  21. paramData: options
  22. })
  23. this.getMerchent()
  24. },
  25. getMerchent() {
  26. let _this = this;
  27. Http.get({
  28. url: config.api.getMerchentList
  29. })
  30. .then(res => {
  31. _this.setData({
  32. list: res.data,
  33. selectList:res.data
  34. })
  35. })
  36. .catch(err => {
  37. tt.showToast({
  38. title: err.message,
  39. icon: 'none',
  40. duration: 2000,
  41. mask: false
  42. });
  43. });
  44. },
  45. /**
  46. * 生命周期函数--监听页面初次渲染完成
  47. */
  48. onReady: function () {
  49. },
  50. checkMerchant(e){
  51. console.log(e)
  52. let id=e.target.id;
  53. this.data.selectList.map((item,index)=>{
  54. if(id==item.id){
  55. console.log(item,item.businessId)
  56. this.setData({
  57. selectMerchant:item,
  58. businessId: item.businessId
  59. })
  60. }
  61. })
  62. },
  63. submitForm(){
  64. if (this.data.selectMerchant!=null){
  65. tt.redirectTo({
  66. url: `/pages/operation/index?address=${this.data.paramData.address}&id=${this.data.paramData.id}&levelName=${this.data.paramData.levelName}&name=${this.data.paramData.name}&nickName=${this.data.paramData.nickName}&phone=${this.data.paramData.phone}&score=${this.data.paramData.score}&credit=${this.data.paramData.credit}&type=1&merchantName=${this.data.selectMerchant.merchantName}&merchant_id=${this.data.selectMerchant.id}&isAdmin=1&merchantType=1&businessId=${this.data.businessId}`,
  67. })
  68. }else{
  69. tt.showToast({
  70. title: '抱歉,您未选择门店',
  71. icon: 'none',
  72. duration: 2000,
  73. mask: false
  74. });
  75. }
  76. },
  77. getList(e){
  78. console.log(e.detail.value)
  79. let selectList = [];
  80. var reg = new RegExp(e.detail.value.toUpperCase());
  81. this.data.list.map((item,index)=>{
  82. if (item.merchantName.toUpperCase().match(reg) || e.detail.value==''){
  83. selectList.push(item)
  84. }
  85. })
  86. let haveIf=false;
  87. selectList.map((item,index)=>{
  88. console.log(item,this.data.selectMerchant)
  89. if (this.data.selectMerchant!=null&&item.id == this.data.selectMerchant.id){
  90. haveIf=true
  91. }
  92. })
  93. if (!haveIf){
  94. this.setData({
  95. selectMerchant:null
  96. })
  97. }
  98. // debugger
  99. this.setData({
  100. selectList
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面显示
  105. */
  106. onShow: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面隐藏
  110. */
  111. onHide: function () {
  112. },
  113. /**
  114. * 生命周期函数--监听页面卸载
  115. */
  116. onUnload: function () {
  117. },
  118. /**
  119. * 页面相关事件处理函数--监听用户下拉动作
  120. */
  121. onPullDownRefresh: function () {
  122. },
  123. /**
  124. * 页面上拉触底事件的处理函数
  125. */
  126. onReachBottom: function () {
  127. },
  128. /**
  129. * 用户点击右上角分享
  130. */
  131. onShareAppMessage: function () {
  132. }
  133. })