12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import {
- ApiModel
- } from "../../utils/api";
- const _Http = new ApiModel();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- fisadministrator: {
- type: Number
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- productList: [], //产品列表
- tabsActive: 0, //tabs 下标
- pageNumber: 1, //获取页码
- },
- pageLifetimes: {
- show: function () {
- // 页面被展示
- this.tabsChange({
- detail: {
- index: this.data.tabsActive
- }
- })
- },
- },
- /**
- * 组件的方法列表
- */
- methods: {
- //tabs切换
- tabsChange(e) {
- console.log(e)
- this.setData({
- tabsActive: e.detail.index,
- pageNumber: 1
- })
- if (e.detail.index == 0) {
- console.log("全部")
- this.queryProduct()
- } else if (e.detail.index == 1) {
- console.log("上架中")
- this.queryProduct({
- "fisonsale": 1
- })
- } else if (e.detail.index == 2) {
- console.log("已下架")
- this.queryProduct({
- "fisonsale": 0
- })
- }
- },
- //搜索
- searchChange(e) {
- let text = e.detail.trim();
- console.log(text)
- },
- //查询商品
- queryProduct(where) {
- _Http.basic({
- "accesstoken": wx.getStorageSync('token'),
- "classname": "customer.products.products",
- "method": "query_productsList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": this.data.pageNumber,
- "pageSize": 20,
- "where": where
- }
- }).then(s => {
- console.log(s)
- if (s.msg != "成功") return;
- //返回列表,页码加1
- this.setData({
- productList: s.data,
- pageNumber: this.data.pageNumber + 1
- })
- })
- },
- //新增或修改
- newAdd() {
- wx.navigateTo({
- url: '/pages/group&product/change?type=product',
- })
- }
- }
- })
|