123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- var util = require('../../utils/util.js');
- var app = getApp();
- var status = require('../../utils/index.js');
- Page({
-
- data: {
- image_thumb: '',
- image_o_full: '',
- orign_image: '',
- shopname: '',
- name: '',
- mobile: '',
- product: ''
- },
-
- onLoad: function (options) {
- status.setNavBgColor();
- },
-
- onReady: function () {
- },
-
- onShow: function () {
- },
- inputShopName: function (e) {
- this.setData({
- shopname: e.detail.value
- })
- },
- inputName: function (e) {
- this.setData({
- name: e.detail.value
- })
- },
- inputMobile: function (e) {
- this.setData({
- mobile: e.detail.value
- })
- },
- inputAdvantage: function (e) {
- this.setData({
- product: e.detail.value
- })
- },
- addImg: function () {
- var that = this;
- wx.chooseImage({
- count: 1,
- success: function (res) {
- var tempFilePaths = res.tempFilePaths;
- var new_thumb_img = that.data.thumb_img;
- wx.showLoading({ title: '上传中' });
- wx.uploadFile({
- url: app.util.url('entry/wxapp/index', {
- 'm': 'lionfish_comshop',
- 'controller': 'goods.doPageUpload'
- }),
- filePath: tempFilePaths[0],
- name: 'upfile',
- formData: {
- 'name': tempFilePaths[0]
- },
- header: {
- 'content-type': 'multipart/form-data'
- },
- success: function (res) {
- wx.hideLoading();
- var data = JSON.parse(res.data);
- var image_thumb = data.image_thumb;
- var image_o_full = data.image_o_full;
- var orign_image = data.image_o;
- that.setData({
- image_thumb: image_thumb,
- image_o_full: image_o_full,
- orign_image: orign_image
- })
- }
- })
- }
- });
- },
- submit: function () {
- var token = wx.getStorageSync('token');
- var shopname = this.data.shopname;
- var mobile = this.data.mobile;
- var name = this.data.name;
- var product = this.data.product;
-
- var that = this;
- if (shopname == '') {
- wx.showToast({
- title: '请填供应商名称',
- icon: 'none',
- })
- return false;
- }
- if (name == '') {
- wx.showToast({
- title: '请填写供应商联系人',
- icon: 'none',
- })
- return false;
- }
- if (mobile == '' || !(/^1(3|4|5|6|7|8|9)\d{9}$/.test(mobile))) {
- wx.showToast({
- title: '手机号码有误',
- icon: 'none',
- })
- return false;
- }
- var s_data = {
- shopname, name, mobile, product, controller: 'user.supply_apply', 'token': token
- };
- app.util.request({
- 'url': 'entry/wxapp/user',
- 'data': s_data,
- method: 'post',
- dataType: 'json',
- success: function (res) {
- if (res.data.code == 0) {
- wx.showToast({
- title: '提交成功,等待审核',
- icon: 'none',
- duration: 2000,
- success: function(){
- setTimeout(()=>{
- wx.switchTab({
- url: '/lionfish_comshop/pages/user/me',
- })
- }, 2000)
- }
- })
- } else {
- wx.showModal({
- title: '提示',
- content: res.data.msg,
- showCancel: false
- })
- }
- }
- })
- }
- })
|