123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- const app = getApp();
- const api = require('../../api/api');
- Page({
-
- data: {
- navbarData: {
- showCapsule: 1,
- title: '选品大厅',
- capsuleMode: 'navBack',
- },
- tabs: ['供应大厅', '关联供应商', '我的申请'],
- tabindex: 0,
- height: 0,
- biaoqians: [],
- showbiaoqian: false,
- lists: [],
- bqs: 0,
- wlist: [],
- wbqs: 0,
- supplyhall_list: [],
- supplyhall_supplier_list: [],
-
- shenqingindex: 0,
- gang_name: '',
- supplyhall_help_sell: [],
- time: -1,
- },
- tabtap(e) {
- this.setData({
- tabindex: e.currentTarget.dataset.index
- })
- },
- shenq(e) {
- this.setData({
- shenqingindex: e.currentTarget.dataset.index
- })
- this.getSupplyhallHelpSell()
- },
-
- chongzhi() {
- let list = this.data.biaoqians
- for (let i = 0; i < list.length; i++) {
- list[i].xuan = 0
- }
- this.setData({
- biaoqians: list,
- lists: list,
- bqs: 0,
- showbiaoqian: false,
- wbqs: 0
- })
- this.getSupplyhallList()
- this.getSupplyhallSupplierList()
- },
-
- wancheng() {
- let that = this;
- that.setData({
- lists: that.data.wlist,
- bqs: that.data.wbqs,
- showbiaoqian: false
- })
- let classification_id = [];
- for (let i = 0; i < that.data.lists.length; i++) {
- if (that.data.lists[i].xuan === 1) {
- classification_id.push(that.data.lists[i].id)
- }
- }
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Supplyhall_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- data: {
- classification_id: classification_id
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- supplyhall_list: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- wx.request({
- url: api.Supplyhall_supplier_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- data: {
- id: classification_id
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- supplyhall_supplier_list: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- closebiaoqian() {
- this.setData({
- showbiaoqian: false
- })
- },
-
- biaoqianshow() {
- this.setData({
- showbiaoqian: true
- })
- },
-
- xuan(e) {
- let list = this.data.biaoqians;
- let bqs = this.data.wbqs;
- let index = e.currentTarget.dataset.index;
- if (list[index].xuan == 0) {
- list[index].xuan = 1;
- bqs++;
- } else {
- list[index].xuan = 0;
- bqs--;
- };
- this.setData({
- biaoqians: list,
- wlist: list,
- wbqs: bqs
- })
- },
-
- onLoad: function (options) {
- this.setData({
- height: app.globalData.height
- })
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- let that = this;
-
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Classification_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- let arr = res.data.data;
- for (let i = 0; i < arr.length; i++) {
- arr[i].xuan = 0;
- }
- that.setData({
- biaoqians: arr
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
-
- that.getSupplyhallList()
-
- that.getSupplyhallSupplierList()
-
- that.getSupplyhallHelpSell()
- },
-
- onHide: function () {
- },
-
- onUnload: function () {
- },
-
- onPullDownRefresh: function () {
- },
-
- onReachBottom: function () {
- },
-
- onShareAppMessage: function () {
- },
-
- getSupplyhallList() {
- let that = this;
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Supplyhall_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- supplyhall_list: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- getSupplyhallSupplierList() {
- let that = this;
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Supplyhall_supplier_list,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- supplyhall_supplier_list: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- inputGangName(e) {
- let that = this;
- that.setData({
- gang_name: e.detail.value
- })
-
- clearTimeout(that.data.time);
-
- this.data.time = setTimeout(() => {
- that.getSupplyhallHelpSell()
- }, 500)
- },
-
- getSupplyhallHelpSell() {
- let that = this;
- wx.showLoading({
- title: '加载中',
- mask: true
- })
- wx.request({
- url: api.Supplyhall_help_sell,
- header: {
- 'Authorization': wx.getStorageSync('token')
- },
- data: {
- apply_status: Number(that.data.shenqingindex),
- gang_name: that.data.gang_name
- },
- method: 'POST',
- success(res) {
- console.log(res);
- if (res.data.code === 1) {
- that.setData({
- supplyhall_help_sell: res.data.data
- })
- } else {
- wx.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'none'
- })
- }
- },
- fail(err) {
- wx.showToast({
- title: '发起网络请求失败',
- icon: 'none',
- mask: true
- })
- },
- complete() {
- wx.hideLoading()
- }
- })
- },
-
- navFromGYDT(e) {
-
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/tuanzdetail/tuanzdetail?type=0&id=' + id,
- })
- },
-
- navFromGLGYS(e) {
-
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/tuanzdetail/tuanzdetail?type=1&id=' + id,
- })
- },
-
- navFromWDSQ(e) {
- let id = e.currentTarget.dataset.id;
- let status = e.currentTarget.dataset.status;
- let uid = e.currentTarget.dataset.uid;
- wx.navigateTo({
- url: '/pages/myapplyfor/myapplyfor?id=' + id + '&status=' + status + '&uid=' + uid,
- })
- }
- })
|