作者 lihongjuan

1

正在显示 84 个修改的文件 包含 5655 行增加0 行删除
  1 +//app.js
  2 +App({
  3 + onLaunch: function () {
  4 + // 展示本地存储能力
  5 + var logs = wx.getStorageSync('logs') || []
  6 + logs.unshift(Date.now())
  7 + wx.setStorageSync('logs', logs)
  8 +
  9 + // 登录
  10 + wx.login({
  11 + success: res => {
  12 + // 发送 res.code 到后台换取 openId, sessionKey, unionId
  13 + }
  14 + })
  15 + // 获取用户信息
  16 + wx.getSetting({
  17 + success: res => {
  18 + if (res.authSetting['scope.userInfo']) {
  19 + // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  20 + wx.getUserInfo({
  21 + success: res => {
  22 + // 可以将 res 发送给后台解码出 unionId
  23 + this.globalData.userInfo = res.userInfo
  24 +
  25 + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  26 + // 所以此处加入 callback 以防止这种情况
  27 + if (this.userInfoReadyCallback) {
  28 + this.userInfoReadyCallback(res)
  29 + }
  30 + }
  31 + })
  32 + }
  33 + }
  34 + })
  35 + },
  36 +
  37 + //封装公共接口
  38 +
  39 + post: function (url, data, headerParams) {
  40 + wx.showNavigationBarLoading()
  41 + var promise = new Promise((resolve, reject) => {
  42 + //init
  43 + let that = this;
  44 + let postData = data;
  45 + let baseUrl = 'https://biology.w.broing.cn/api/';
  46 + //网络请求
  47 + let header = {
  48 + // 'XX-Device-Type': 'wxapp',
  49 + 'token': wx.getStorageSync("token") || ''
  50 + }
  51 + header = Object.assign(header, headerParams)
  52 + //网络请求
  53 + wx.request({
  54 + url: baseUrl + url,
  55 + data: postData,
  56 + method: headerParams,
  57 + header: header,
  58 + success: function (res) { //返回取得的数据
  59 + if (res.data.code == '1') {
  60 + resolve(res.data.data);
  61 + } else if (res.data.code == '201') {
  62 + resolve(res.data);
  63 + } else {
  64 + // wx.showToast({
  65 + // title: res.data.msg,
  66 + // duration: 1200,
  67 + // icon: 'none'
  68 + // })
  69 + reject(res)
  70 + }
  71 +
  72 + // else if (res.data.code == '42002') {
  73 +
  74 + // }
  75 + // setTimeout(function () {
  76 +
  77 + // wx.hideNavigationBarLoading()
  78 + // }, 600)
  79 + },
  80 + fail: function (e) {
  81 + reject('网络出错');
  82 + // wx.hideLoading()
  83 + wx.hideNavigationBarLoading()
  84 + },
  85 + complete: function () {
  86 + wx.hideNavigationBarLoading()
  87 + },
  88 + })
  89 + });
  90 + return promise;
  91 + },
  92 +
  93 +
  94 +
  95 +
  96 + globalData: {
  97 + userInfo: null
  98 + }
  99 +})
  1 +{
  2 + "pages": [
  3 +
  4 + "pages/sousuo/sousuo",
  5 + "pages/login/login",
  6 + "pages/seemore/seemore",
  7 + "pages/orderdetail/orderdetail",
  8 + "pages/myorder/myorder",
  9 + "pages/fapiaoxinxi/fapiaoxinxi",
  10 + "pages/gouwuche/gouwuche",
  11 + "pages/addkehu/addkehu",
  12 + "pages/mykehu/mykehu",
  13 + "pages/gouwucart/gouwucart",
  14 + "pages/mine/mine",
  15 + "pages/index/index",
  16 + "pages/logs/logs"
  17 +
  18 + ],
  19 + "window": {
  20 + "backgroundTextStyle": "light",
  21 + "navigationBarBackgroundColor": "#fff",
  22 + "navigationBarTitleText": "",
  23 + "navigationBarTextStyle": "black"
  24 + },
  25 + "sitemapLocation": "sitemap.json",
  26 + "tabBar": {
  27 + "selectedColor": "#2781FB",
  28 + "list": [
  29 + {
  30 + "pagePath": "pages/sousuo/sousuo",
  31 + "text": "搜索",
  32 + "selectedColor": "#2781FB",
  33 + "iconPath": "img/sou.png",
  34 + "selectedIconPath": "img/souactive.png"
  35 + },
  36 + {
  37 + "pagePath": "pages/mine/mine",
  38 + "text": "我的",
  39 + "selectedColor": "#2781FB",
  40 + "iconPath": "img/mine.png",
  41 + "selectedIconPath": "img/mineactive.png"
  42 + }
  43 + ]
  44 + }
  45 +}
  1 +/**app.wxss**/
  2 +.container {
  3 + height: 100%;
  4 + display: flex;
  5 + flex-direction: column;
  6 + align-items: center;
  7 + justify-content: space-between;
  8 + padding: 200rpx 0;
  9 + box-sizing: border-box;
  10 +}
  11 +.register {
  12 + width: 100%;
  13 + height: 100%;
  14 + background-color: rgba(0, 0, 0, 0.5);
  15 + position: fixed;
  16 + top: 0;
  17 + left: 0;
  18 + right: 0;
  19 + z-index: 5;
  20 +}
  21 +
  22 +image{
  23 + width:100%;
  24 + height:100%;
  25 +}
  26 +.nodata{
  27 + color:#999;
  28 + font-size: 30rpx;
  29 + text-align: center;
  30 + margin-top:20rpx;
  31 +}
  32 +
  33 +.cartkongimg{
  34 + width:399rpx;
  35 + height:491rpx;
  36 + font-size: 0;
  37 + margin:179rpx auto 0;
  38 +
  39 +}
  40 +.konggou{
  41 + color:#141414;
  42 + font-size: 32rpx;
  43 + text-align: center;
  44 + margin-top:57rpx;
  45 +}

339 字节

183 字节

897 字节

  1 +// pages/addkehu/addkehu.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + selshow: true,
  10 + region: [],
  11 + kindtype: 0,
  12 + province_id: '',
  13 + city_id: '',
  14 + region_id: '',
  15 + address: '',
  16 +
  17 + is_default: 0,
  18 + reginname: '',
  19 + customer_name: '',
  20 + shouhuoname: '',
  21 + mobile: '',
  22 + address: '',
  23 + type: '',
  24 + invoice: '',
  25 + number: '',
  26 + editype: '',
  27 + editid: '',
  28 + lianxiname: '',
  29 + diquselect:''
  30 +
  31 + },
  32 +
  33 + /**
  34 + * 生命周期函数--监听页面加载
  35 + */
  36 + onLoad: function(options) {
  37 + // this.setData({
  38 + // province_id: '110000',
  39 + // city_id: '110100',
  40 + // region_id: '110106',
  41 + // reginname: this.data.region[0] + "-" + this.data.region[1] + "-" + this.data.region[2]
  42 + // })
  43 + if (options.editype != undefined) {
  44 + this.setData({
  45 + editype: options.editype,
  46 + editid: options.id
  47 + })
  48 +
  49 + this.getkehudetail()
  50 +
  51 +
  52 + }
  53 + },
  54 +
  55 + //获取用户详情页
  56 + getkehudetail() {
  57 + let url = 'user/customerDetail';
  58 + let param = {
  59 + customer_id: this.data.editid
  60 + }
  61 +
  62 + app.post(url, param, 'get').then((res) => {
  63 + console.log(res);
  64 + if (res.region!=''){
  65 + let newregion = res.region;
  66 + newregion = newregion.split("-")
  67 + this.setData({
  68 + diquselect: newregion[0] + newregion[1] + newregion[2]
  69 + })
  70 + }else{
  71 + this.setData({
  72 + diquselect:''
  73 + })
  74 + }
  75 +
  76 +
  77 + this.setData({
  78 + customer_name: res.customer_name,
  79 + mobile: res.mobile,
  80 + province_id: res.province_id,
  81 + city_id: res.city_id,
  82 + region_id: res.area_id,
  83 + address: res.address,
  84 + kindtype: res.type,
  85 + invoice: res.invoice,
  86 + number: res.number,
  87 + region: res.region.split("-"),
  88 + reginname: res.region,
  89 + is_default: res.is_default,
  90 + shouhuoname: res.receive_name,
  91 + lianxiname: res.contact_name,
  92 +
  93 + })
  94 +
  95 +
  96 + if (res.is_default == 0) {
  97 + this.setData({
  98 + selshow: true
  99 + })
  100 + } else {
  101 + this.setData({
  102 + selshow: false
  103 + })
  104 + }
  105 +
  106 + console.log(this.data.selshow)
  107 +
  108 +
  109 + }).catch((err) => {
  110 +
  111 +
  112 + })
  113 + },
  114 +
  115 + //选择省市区
  116 + bindRegionChange: function(e) {
  117 + console.log(e)
  118 + console.log('picker发送选择改变,携带值为', e.detail.value)
  119 + this.setData({
  120 + region: e.detail.value,
  121 + province_id: e.detail.code[0],
  122 + city_id: e.detail.code[1],
  123 + region_id: e.detail.code[2],
  124 + reginname: e.detail.value[0] + '-' + e.detail.value[1] + '-' + e.detail.value[2],
  125 + diquselect: e.detail.value[0] + e.detail.value[1] + e.detail.value[2]
  126 +
  127 + })
  128 + },
  129 +
  130 + xuanopen() {
  131 + this.setData({
  132 + selshow: !this.data.selshow
  133 + })
  134 +
  135 + if (this.data.selshow == true) {
  136 + this.setData({
  137 + is_default: 0
  138 + })
  139 + } else {
  140 + this.setData({
  141 + is_default: 1
  142 + })
  143 + }
  144 +
  145 + console.log(this.data.is_default)
  146 + },
  147 + //输入客户名称
  148 + enterkehu(e) {
  149 + this.setData({
  150 + customer_name: e.detail.value
  151 + })
  152 + },
  153 + //输入联系人
  154 + enterlianxi(e) {
  155 + this.setData({
  156 + lianxiname: e.detail.value
  157 + })
  158 + },
  159 + //输入收货人
  160 + entershouhuo(e) {
  161 + this.setData({
  162 + shouhuoname: e.detail.value
  163 + })
  164 + },
  165 +
  166 + //输入客户手机号
  167 + enterphone(e) {
  168 + this.setData({
  169 + mobile: e.detail.value
  170 + })
  171 + },
  172 +
  173 + // 选择发票类型
  174 + selectkind(e) {
  175 + this.setData({
  176 + kindtype: e.currentTarget.dataset.type
  177 + })
  178 + },
  179 +
  180 + //输入详细地址
  181 + enteraddress(e) {
  182 + this.setData({
  183 + address: e.detail.value
  184 + })
  185 + },
  186 +
  187 + //输入发票抬头
  188 + fapiaohead(e) {
  189 + this.setData({
  190 + invoice: e.detail.value
  191 + })
  192 +
  193 + console.log(this.data.invoice)
  194 + },
  195 +
  196 + //税号
  197 + shuihao(e) {
  198 + this.setData({
  199 + number: e.detail.value
  200 + })
  201 + },
  202 +
  203 + //添加新用户
  204 + quding() {
  205 +
  206 +
  207 + if (this.data.customer_name == '') {
  208 + wx.showToast({
  209 + title: '请输入客户名称',
  210 + icon: "none"
  211 + })
  212 +
  213 + return false
  214 + }
  215 +
  216 + if (this.data.shouhuoname==''){
  217 + wx.showToast({
  218 + title: '请输入收货人',
  219 + icon: "none"
  220 + })
  221 + return false
  222 + }
  223 +
  224 + // if(this.data.lianxiname==''){
  225 + // wx.showToast({
  226 + // title: '请输入联系人',
  227 + // icon: "none"
  228 + // })
  229 +
  230 + // return false
  231 + // }
  232 +
  233 + // if (this.data.mobile == '') {
  234 + // wx.showToast({
  235 + // title: '请输入手机号',
  236 + // icon: "none"
  237 + // })
  238 +
  239 + // return false
  240 + // }
  241 +
  242 + if (this.data.mobile != '') {
  243 + let reg = reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  244 + if (!reg.test(this.data.mobile)) {
  245 + wx.showToast({
  246 + title: '请输入正确的手机号',
  247 + icon: "none"
  248 + })
  249 +
  250 + return false
  251 + }
  252 + }
  253 +
  254 +
  255 +
  256 + // if(this.data.address==''){
  257 + // wx.showToast({
  258 + // title: '请输入详细地址',
  259 + // icon:"none"
  260 + // })
  261 +
  262 + // return false
  263 + // }
  264 +
  265 + // if (this.data.invoice==''){
  266 + // wx.showToast({
  267 + // title: '请输入发票抬头',
  268 + // icon:'none'
  269 + // })
  270 +
  271 + // return false
  272 + // }
  273 +
  274 + // if (this.data.number==''){
  275 + // wx.showToast({
  276 + // title: '请输入税号',
  277 + // icon:'none'
  278 + // })
  279 +
  280 + // return false
  281 + // }
  282 +
  283 +
  284 + let url = 'user/addCustomer';
  285 + let param = {
  286 + customer_name: this.data.customer_name,
  287 + receive_name: this.data.shouhuoname,
  288 + contact_name: this.data.lianxiname,
  289 + mobile: this.data.mobile,
  290 + province_id: this.data.province_id,
  291 + city_id: this.data.city_id,
  292 + area_id: this.data.region_id,
  293 + region: this.data.reginname,
  294 + address: this.data.address,
  295 + type: this.data.kindtype,
  296 + invoice: this.data.invoice,
  297 + number: this.data.number,
  298 + is_default: this.data.is_default
  299 + }
  300 +
  301 + app.post(url, param, 'post').then((res) => {
  302 + console.log(res);
  303 + wx.showToast({
  304 + title: '添加客户成功',
  305 + icon: 'none'
  306 + })
  307 +
  308 + setTimeout(function() {
  309 + wx.navigateBack({
  310 + checked: true
  311 + })
  312 + }, 1500)
  313 +
  314 + }).catch((err) => {
  315 + console.log(err)
  316 + wx.showToast({
  317 + title: err.data.msg,
  318 + icon: "none"
  319 + })
  320 +
  321 + })
  322 + },
  323 +
  324 + //编辑客户
  325 +
  326 + editqueding() {
  327 + if (this.data.customer_name == '') {
  328 + wx.showToast({
  329 + title: '请输入客户名称',
  330 + icon: "none"
  331 + })
  332 +
  333 + return false
  334 + }
  335 +
  336 + if (this.data.shouhuoname == '') {
  337 + wx.showToast({
  338 + title: '请输入收货人',
  339 + icon: "none"
  340 + })
  341 + return false
  342 + }
  343 +
  344 + // if (this.data.mobile == '') {
  345 + // wx.showToast({
  346 + // title: '请输入手机号',
  347 + // icon: "none"
  348 + // })
  349 +
  350 + // return false
  351 + // }
  352 +
  353 + if (this.data.mobile!=''){
  354 + let reg = reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  355 + if (!reg.test(this.data.mobile)) {
  356 + wx.showToast({
  357 + title: '请输入正确的手机号',
  358 + icon: "none"
  359 + })
  360 +
  361 + return false
  362 + }
  363 + }
  364 +
  365 +
  366 +
  367 + // if (this.data.address == '') {
  368 + // wx.showToast({
  369 + // title: '请输入详细地址',
  370 + // icon: "none"
  371 + // })
  372 +
  373 + // return false
  374 + // }
  375 +
  376 + // if (this.data.invoice == '') {
  377 + // wx.showToast({
  378 + // title: '请输入发票抬头',
  379 + // icon: 'none'
  380 + // })
  381 +
  382 + // return false
  383 + // }
  384 +
  385 + // if (this.data.number == '') {
  386 + // wx.showToast({
  387 + // title: '请输入税号',
  388 + // icon: 'none'
  389 + // })
  390 +
  391 + // return false
  392 + // }
  393 +
  394 +
  395 + let url = 'user/editCustomer';
  396 + let param = {
  397 + id: this.data.editid,
  398 + customer_name: this.data.customer_name,
  399 + receive_name: this.data.shouhuoname,
  400 + contact_name: this.data.lianxiname,
  401 + mobile: this.data.mobile,
  402 + province_id: this.data.province_id,
  403 + city_id: this.data.city_id,
  404 + area_id: this.data.region_id,
  405 + region: this.data.reginname,
  406 + address: this.data.address,
  407 + type: this.data.kindtype,
  408 + invoice: this.data.invoice,
  409 + number: this.data.number,
  410 + is_default: this.data.is_default
  411 + }
  412 +
  413 + app.post(url, param, 'post').then((res) => {
  414 + console.log(res);
  415 + wx.showToast({
  416 + title: '编辑客户成功',
  417 + icon: 'none'
  418 + })
  419 +
  420 + setTimeout(function() {
  421 + wx.navigateBack({
  422 + checked: true
  423 + })
  424 + }, 1500)
  425 +
  426 + }).catch((err) => {
  427 + console.log(err)
  428 + wx.showToast({
  429 + title: err.data.msg,
  430 + icon: "none"
  431 + })
  432 +
  433 + })
  434 + },
  435 + /**
  436 + * 生命周期函数--监听页面初次渲染完成
  437 + */
  438 + onReady: function() {
  439 +
  440 + },
  441 +
  442 + /**
  443 + * 生命周期函数--监听页面显示
  444 + */
  445 + onShow: function() {
  446 +
  447 + },
  448 +
  449 + /**
  450 + * 生命周期函数--监听页面隐藏
  451 + */
  452 + onHide: function() {
  453 +
  454 + },
  455 +
  456 + /**
  457 + * 生命周期函数--监听页面卸载
  458 + */
  459 + onUnload: function() {
  460 +
  461 + },
  462 +
  463 + /**
  464 + * 页面相关事件处理函数--监听用户下拉动作
  465 + */
  466 + onPullDownRefresh: function() {
  467 +
  468 + },
  469 +
  470 + /**
  471 + * 页面上拉触底事件的处理函数
  472 + */
  473 + onReachBottom: function() {
  474 +
  475 + },
  476 +
  477 + /**
  478 + * 用户点击右上角分享
  479 + */
  480 + onShareAppMessage: function() {
  481 +
  482 + }
  483 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="tianjiakehu">添加客户</view>
  2 +
  3 +<view class="kehubox">
  4 +
  5 + <view class="kehutian">
  6 + <view class="fapiaotai ming">
  7 + <text class="kehuact">客户名称</text>
  8 +
  9 + </view>
  10 + <view class="fapiaotaienter ming">
  11 + <input placeholder='请输入客户名称' placeholder-class='shurufa' bindinput="enterkehu" value="{{customer_name}}" />
  12 + </view>
  13 + </view>
  14 +
  15 + <view class="kehutian">
  16 + <view class="fapiaotai ming">
  17 + <text class="kehuact">收货人</text>
  18 +
  19 + </view>
  20 + <view class="fapiaotaienter ming">
  21 + <input placeholder='请输入收货人' placeholder-class='shurufa' bindinput="entershouhuo" value="{{shouhuoname}}" />
  22 + </view>
  23 + </view>
  24 +
  25 + <view class="kehutian">
  26 + <view class="fapiaotai ming">联系人</view>
  27 + <view class="fapiaotaienter ming">
  28 + <input placeholder='请输入联系人' placeholder-class='shurufa' bindinput="enterlianxi" value="{{lianxiname}}" />
  29 + </view>
  30 + </view>
  31 +
  32 + <view class="kehutian">
  33 + <view class="fapiaotai ming">手机号</view>
  34 + <view class="fapiaotaienter ming">
  35 + <input placeholder='请输入手机号' placeholder-class='shurufa' bindinput="enterphone" type="number" value="{{mobile}}" />
  36 + </view>
  37 + </view>
  38 +
  39 +
  40 + <!-- <view class="kehuitem">
  41 + <input placeholder='客户名称' />
  42 + </view> -->
  43 +
  44 + <view class="kehuitem diquitem">
  45 + <view class="diqusel">地区选择</view>
  46 + <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
  47 + <view class="diquright">
  48 +
  49 + <view class="selcity">
  50 + <view class="selectdiqu">
  51 + {{diquselect}}
  52 + <!-- {{region[0]}}{{region[1]}}{{region[2]}} -->
  53 + </view>
  54 +
  55 + <view class="selimg">
  56 + <image src="/img/xiasanjiao.png"></image>
  57 + </view>
  58 + </view>
  59 + <!-- <view class="quan">
  60 + <view class="all">全部</view>
  61 + <view class="selimg">
  62 + <image src="/img/xiasanjiao.png"></image>
  63 + </view>
  64 + </view> -->
  65 + </view>
  66 + </picker>
  67 +
  68 +
  69 +
  70 +
  71 + </view>
  72 +
  73 + <view class="kehutian">
  74 + <view class="fapiaotai ming">详细地址</view>
  75 + <view class="fapiaotaienter ming">
  76 + <input placeholder='请输入详细地址' bindinput="enteraddress" placeholder-class='shurufa' value="{{address}}" value="{{address}}" />
  77 + </view>
  78 + </view>
  79 +
  80 +</view>
  81 +
  82 +<!-- 发票信息 -->
  83 +<view class="fapiaoinfo">
  84 + <view class="fapiaoword">发票信息</view>
  85 +
  86 + <view class="taitouleixing">
  87 + <view class="infoleft">抬头类型</view>
  88 +
  89 + <view class="infoitem" bindtap="selectkind" data-type="0">
  90 + <view class="taitouimg">
  91 + <image src="{{kindtype==0?'/img/xuan.png':'/img/noxuan.png'}}"></image>
  92 + </view>
  93 + <view class="qiyedanwei">企业单位</view>
  94 + </view>
  95 +
  96 + <view class="infoitem" bindtap="selectkind" data-type="1">
  97 + <view class="taitouimg">
  98 +
  99 + <image src="{{kindtype==1?'/img/xuan.png':'/img/noxuan.png'}}"></image>
  100 +
  101 + </view>
  102 +
  103 + <view class="qiyedanwei">个人/非企业单位</view>
  104 + </view>
  105 + </view>
  106 +
  107 +
  108 + <view class="fapiaotaitouhead">
  109 + <view class="fapiaotai">发票抬头</view>
  110 + <view class="fapiaotaienter">
  111 + <input placeholder='请输入发票抬头' bindinput="fapiaohead" placeholder-class='shurufa' value="{{invoice}}" />
  112 + </view>
  113 + </view>
  114 + <view class="fapiaotaitouhead">
  115 + <view class="fapiaotai">税号</view>
  116 +
  117 + <view class="fapiaotaienter">
  118 + <input placeholder='请输入税号' bindinput="shuihao" placeholder-class='shurufa' value="{{number}}" />
  119 + </view>
  120 + </view>
  121 +
  122 +
  123 + <!-- <view class="zongjine">
  124 + <view class="zongjineleft">总金额</view>
  125 + <view class="zongjineright">¥190</view>
  126 + </view> -->
  127 +</view>
  128 +
  129 +
  130 +<view class="shezhimoren">
  131 + <view class="shezhileft">是否设置为默认用户</view>
  132 +
  133 + <view class="shezhiimg" bindtap="xuanopen">
  134 + <image src="/img/close.png" wx:if="{{selshow}}"></image>
  135 + <image src="/img/open.png" wx:else></image>
  136 + </view>
  137 +</view>
  138 +<view class="quding" bindtap="editqueding" wx:if="{{editype==1}}">确定</view>
  139 +<view class="quding" bindtap="quding" wx:else>确定</view>
  1 +page {
  2 + background: #f5f5fa;
  3 + padding: 34rpx 23rpx;
  4 + box-sizing: border-box;
  5 +}
  6 +
  7 +.tianjiakehu {
  8 + color: #141414;
  9 + font-size: 40rpx;
  10 + font-weight: bold;
  11 +}
  12 +
  13 +.kehubox {
  14 + width: 702rpx;
  15 + border-radius: 28rpx;
  16 + padding: 0 23rpx;
  17 + box-sizing: border-box;
  18 + background: #fff;
  19 + margin-top: 30rpx;
  20 +}
  21 +
  22 +.kehuitem {
  23 + padding: 28rpx 0;
  24 + box-sizing: border-box;
  25 + border-bottom: 1rpx solid #f5f5f5;
  26 +}
  27 +
  28 +.diquitem {
  29 + display: flex;
  30 + align-items: center;
  31 + justify-content: space-between;
  32 +}
  33 +
  34 +.diqusel {
  35 + color: #9e9e9e;
  36 + font-size: 28rpx;
  37 +}
  38 +
  39 +.diquright {
  40 + display: flex;
  41 + align-items: center;
  42 +}
  43 +
  44 +.selectdiqu {
  45 + font-size: 24rpx;
  46 + margin-right: 21rpx;
  47 +}
  48 +
  49 +.all {
  50 + color: #141414;
  51 + font-size: 24rpx;
  52 + margin-right: 21rpx;
  53 +}
  54 +
  55 +.selcity {
  56 + display: flex;
  57 + align-items: center;
  58 + margin-right: 21rpx;
  59 + padding: 0 17rpx;
  60 + box-sizing: border-box;
  61 + border: 1rpx solid #9e9e9e;
  62 + border-radius: 17rpx;
  63 + color: #141414;
  64 +}
  65 +
  66 +.selimg {
  67 + width: 18rpx;
  68 + height: 15rpx;
  69 + font-size: 0;
  70 +}
  71 +
  72 +.quan {
  73 + display: flex;
  74 + align-items: center;
  75 + padding: 0 15rpx;
  76 + box-sizing: border-box;
  77 + border: 1rpx solid #9e9e9e;
  78 + border-radius: 17rpx;
  79 +}
  80 +
  81 +.shezhiimg {
  82 + width: 70rpx;
  83 + height: 68rpx;
  84 + font-size: 0;
  85 +}
  86 +
  87 +.shezhimoren {
  88 + display: flex;
  89 + align-items: center;
  90 + justify-content: space-between;
  91 + padding: 8rpx 23rpx;
  92 + box-sizing: border-box;
  93 + background: #fff;
  94 + margin-top: 38rpx;
  95 + border-radius: 28rpx;
  96 +}
  97 +
  98 +/* 发票信息 */
  99 +
  100 +.fapiaoinfo {
  101 + width: 702rpx;
  102 + height: 407rpx;
  103 + border-radius: 28rpx;
  104 + margin: 53rpx auto 0;
  105 + background: #fff;
  106 + padding: 36rpx 42rpx;
  107 + box-sizing: border-box;
  108 +}
  109 +
  110 +.fapiaoinfo {
  111 + color: #141414;
  112 + font-size: 32rpx;
  113 +}
  114 +
  115 +.taitouimg {
  116 + width: 14rpx;
  117 + height: 14rpx;
  118 + font-size: 0;
  119 +}
  120 +
  121 +.taitouleixing {
  122 + display: flex;
  123 + align-items: center;
  124 + margin-top: 21rpx;
  125 +}
  126 +
  127 +.infoitem {
  128 + display: flex;
  129 + align-items: center;
  130 + margin-left: 39rpx;
  131 +}
  132 +
  133 +.infoleft {
  134 + color: #9e9e9e;
  135 + font-size: 28rpx;
  136 +}
  137 +
  138 +.qiyedanwei {
  139 + color: #141414;
  140 + font-size: 28rpx;
  141 + margin-left: 10rpx;
  142 +}
  143 +
  144 +.fapiaotai {
  145 + width:140rpx;
  146 + color: #9e9e9e;
  147 + font-size: 28rpx;
  148 + margin-top: 21rpx;
  149 +}
  150 +
  151 +.zongjine {
  152 + display: flex;
  153 + align-items: center;
  154 + justify-content: space-between;
  155 +}
  156 +
  157 +.fapiaoword {
  158 + color: #141414;
  159 + font-size: 28rpx;
  160 +}
  161 +
  162 +.zongjine {
  163 + color: #9e9e9e;
  164 + font-size: 28rpx;
  165 + margin-top: 10rpx;
  166 +}
  167 +
  168 +.fapiaotaitouhead {
  169 + display: flex;
  170 + align-items: center;
  171 +}
  172 +
  173 +.fapiaotaienter {
  174 + width: 400rpx;
  175 + margin-left: 20rpx;
  176 + margin-top: 21rpx;
  177 + color: #9e9e9e;
  178 + font-size: 28rpx;
  179 +}
  180 +.shurufa{
  181 + color: #9e9e9e;
  182 + font-size: 28rpx;
  183 +}
  184 +.kehutian{
  185 + display:flex;
  186 + align-items: center;
  187 + border-bottom:1rpx solid #f5f5f5;
  188 + padding: 25rpx 0;
  189 + box-sizing: border-box
  190 +}
  191 +.ming{
  192 + margin-top:0
  193 +}
  194 +.quding{
  195 + width:686rpx;
  196 + height:88rpx;
  197 + background: #2781FB;
  198 + color:#fff;
  199 + font-size: 28rpx;
  200 + text-align: center;
  201 + line-height: 88rpx;
  202 + margin:40rpx auto 0;
  203 + border-radius: 20rpx;
  204 +}
  205 +.zongjineright{
  206 + color:#2781FB;
  207 + font-size: 28rpx;
  208 +}
  209 +.kehuact{
  210 + position: relative
  211 +}
  212 +.kehuact::after{
  213 + display:block;
  214 + content:'*';
  215 + position: absolute;
  216 + top:0;
  217 + right:-18rpx;
  218 + color:#DA0000;
  219 +}
  1 +// pages/fapiaoxinxi/fapiaoxinxi.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 +
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面初次渲染完成
  20 + */
  21 + onReady: function () {
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面显示
  27 + */
  28 + onShow: function () {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面隐藏
  34 + */
  35 + onHide: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面卸载
  41 + */
  42 + onUnload: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage: function () {
  64 +
  65 + }
  66 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="fapiaoinfo">
  2 + <view class="fapiaoword">发票信息</view>
  3 +
  4 + <view class="taitouleixing">
  5 + <view class="infoleft">抬头类型</view>
  6 +
  7 + <view class="infoitem">
  8 + <view class="taitouimg">
  9 + <image src="/img/noxuan.png"></image>
  10 + </view>
  11 + <view class="qiyedanwei">企业单位</view>
  12 + </view>
  13 +
  14 + <view class="infoitem">
  15 + <view class="taitouimg">
  16 + <image src="/img/noxuan.png"></image>
  17 + </view>
  18 +
  19 + <view class="qiyedanwei">个人/非企业单位</view>
  20 + </view>
  21 + </view>
  22 +
  23 + <view class="fapiaotai">发票抬头</view>
  24 + <view class="fapiaotai">税号</view>
  25 +
  26 + <view class="zongjine">
  27 + <view class="zongjineleft">总金额</view>
  28 + <view class="zongjineright">¥190</view>
  29 + </view>
  30 +</view>
  1 +page{
  2 + background: #F5F5FA
  3 +}
  4 +.fapiaoinfo{
  5 + width:649rpx;
  6 + height:407rpx;
  7 + border-radius: 28rpx;
  8 + margin:53rpx auto 0;
  9 + background: #fff;
  10 + padding: 36rpx 42rpx;
  11 + box-sizing: border-box
  12 +}
  13 +.fapiaoinfo{
  14 + color:#141414;
  15 + font-size: 32rpx;
  16 +}
  17 +.taitouimg{
  18 + width:14rpx;
  19 + height:14rpx;
  20 + font-size: 0
  21 +}
  22 +.taitouleixing{
  23 + display:flex;
  24 + align-items: center;
  25 + margin-top:21rpx;
  26 +}
  27 +.infoitem{
  28 + display:flex;
  29 + align-items: center;
  30 + margin-left:39rpx;
  31 +}
  32 +.infoleft{
  33 + color:#141414;
  34 + font-size: 28rpx;
  35 +}
  36 +.qiyedanwei{
  37 + color:#141414;
  38 + font-size: 28rpx;
  39 + margin-left:10rpx;
  40 +}
  41 +.fapiaotai{
  42 + color:#141414;
  43 + font-size: 28rpx;
  44 + margin-top:21rpx;
  45 +}
  46 +.zongjine{
  47 + display:flex;
  48 + align-items: center;
  49 + justify-content: space-between
  50 +}
  1 +const app=getApp()
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + goodnum:1,
  9 + buyshow:false,
  10 + cart:false,
  11 + name:'',
  12 + page:1,
  13 + goodlist:[],
  14 + shangpinming:'',
  15 + cartid:'',
  16 + count:''
  17 + },
  18 +
  19 + /**
  20 + * 生命周期函数--监听页面加载
  21 + */
  22 + onLoad: function (options) {
  23 + this.setData({
  24 + name:options.name
  25 + })
  26 +
  27 + this.getgoodlist();
  28 + },
  29 +
  30 + //获取商品列表
  31 + getgoodlist(){
  32 + let url = 'index/getGoodsList';
  33 + let param = {
  34 + keyword:this.data.name,
  35 + page: this.data.page
  36 + }
  37 + app.post(url, param, 'get').then((res) => {
  38 + console.log(res);
  39 + this.setData({
  40 + goodlist: this.data.goodlist.concat(res)
  41 + })
  42 +
  43 + }).catch((err) => {
  44 +
  45 + })
  46 + },
  47 +
  48 + //获取购物车数量
  49 + getcartnum(){
  50 +
  51 + let url ='index/getCarCount'
  52 +
  53 + app.post(url, '', 'get').then((res) => {
  54 + console.log(res);
  55 + this.setData({
  56 + count: res.count
  57 + })
  58 +
  59 +
  60 + }).catch((err) => {
  61 +
  62 + })
  63 + },
  64 +
  65 + //输入购物车的数量
  66 + entercartnum(e){
  67 + this.setData({
  68 + goodnum:e.detail.value
  69 + })
  70 + },
  71 + // 增加
  72 + add(){
  73 + let newgoodnum=this.data.goodnum;
  74 + newgoodnum++
  75 + this.setData({
  76 + goodnum:newgoodnum
  77 + })
  78 + },
  79 +
  80 + //减少
  81 + reduce(){
  82 + let newgoodnum = this.data.goodnum;
  83 + if (newgoodnum!=1){
  84 + newgoodnum = newgoodnum-1
  85 + this.setData({
  86 + goodnum: newgoodnum
  87 + })
  88 + }else{
  89 + this.setData({
  90 + goodnum: 1
  91 + })
  92 + }
  93 +
  94 + },
  95 +
  96 + //取消
  97 + quxiao(){
  98 + this.setData({
  99 + buyshow:false
  100 + })
  101 + },
  102 +
  103 + //去购物车
  104 + gouwu(){
  105 + wx.navigateTo({
  106 + url: '/pages/gouwuche/gouwuche',
  107 + })
  108 + },
  109 +
  110 + //添加购物车
  111 + addcart(e){
  112 + this.setData({
  113 + buyshow:true,
  114 + goodnum:1
  115 + })
  116 +
  117 + let obj=e.currentTarget.dataset.obj;
  118 + console.log(obj)
  119 + this.setData({
  120 + shangpinming: obj.number,
  121 + cartid:obj.id
  122 + })
  123 + },
  124 +
  125 + //确定加入购物车
  126 + quding(){
  127 + let that=this;
  128 +
  129 + let url = 'index/addCar';
  130 + let param = {
  131 + goods_id: this.data.cartid,
  132 + number: this.data.goodnum
  133 + }
  134 + app.post(url, param, 'post').then((res) => {
  135 + console.log(res);
  136 + wx.showToast({
  137 + title: '加入购物车成功',
  138 + icon:'none'
  139 + })
  140 +
  141 + setTimeout(function(){
  142 + wx.navigateTo({
  143 + url: '/pages/gouwuche/gouwuche',
  144 + })
  145 + },1500)
  146 +
  147 +
  148 +
  149 + // setTimeout(function(){
  150 + // that.setData({
  151 + // buyshow:false,
  152 + // page:1,
  153 + // goodlist:[]
  154 + // })
  155 +
  156 +
  157 +
  158 + // that.getgoodlist()
  159 + // },1000)
  160 +
  161 +
  162 +
  163 +
  164 + }).catch((err) => {
  165 + console.log(err)
  166 + wx.showToast({
  167 + title: err.data.msg,
  168 + icon:'none'
  169 + })
  170 + })
  171 + },
  172 + /**
  173 + * 生命周期函数--监听页面初次渲染完成
  174 + */
  175 + onReady: function () {
  176 +
  177 + },
  178 +
  179 + /**
  180 + * 生命周期函数--监听页面显示
  181 + */
  182 + onShow: function () {
  183 + this.setData({
  184 + buyshow:false
  185 + })
  186 +
  187 + //获取购物车的数量
  188 + this.getcartnum()
  189 + },
  190 +
  191 + /**
  192 + * 生命周期函数--监听页面隐藏
  193 + */
  194 + onHide: function () {
  195 +
  196 + },
  197 +
  198 + /**
  199 + * 生命周期函数--监听页面卸载
  200 + */
  201 + onUnload: function () {
  202 +
  203 + },
  204 +
  205 + /**
  206 + * 页面相关事件处理函数--监听用户下拉动作
  207 + */
  208 + onPullDownRefresh: function () {
  209 +
  210 + },
  211 +
  212 + /**
  213 + * 页面上拉触底事件的处理函数
  214 + */
  215 + onReachBottom: function () {
  216 + let newpage=this.data.page;
  217 + newpage++;
  218 + this.setData({
  219 + page:newpage
  220 + })
  221 + },
  222 +
  223 + /**
  224 + * 用户点击右上角分享
  225 + */
  226 + onShareAppMessage: function () {
  227 +
  228 + }
  229 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +
  2 +<view class="cartkong" wx:if="{{goodlist.length==0}}">
  3 + <view class="cartkongimg">
  4 + <image src="/img/cartimg.png"></image>
  5 + </view>
  6 +
  7 + <view class="konggou">暂无数据</view>
  8 +</view>
  9 +
  10 +<view class="cartbox" wx:else>
  11 + <view class="cartheadimg">
  12 + <image src="/img/bg_head.png"></image>
  13 +
  14 +
  15 + <view class="carthead">
  16 + <view class="cartheaditem">物料编号</view>
  17 + <view class="cartheaditem">品名</view>
  18 + <view class="cartheaditem">目录价格</view>
  19 + <view class="cartheaditem">开发票名</view>
  20 + <view class="cartheaditem">库存</view>
  21 + <view class="cartheaditem"></view>
  22 +
  23 + </view>
  24 + </view>
  25 + <view class="cartbox">
  26 + <view class="cartboxotem" wx:for="{{goodlist}}" wx:key="">
  27 + <view class="boxitemname">{{item.number}}</view>
  28 + <view class="boxitemname">{{item.name}}</view>
  29 + <view class="boxitemname">{{item.price}}</view>
  30 + <view class="boxitemname">{{item.invoice_name}}</view>
  31 + <view class="boxitemname">{{item.stock}}</view>
  32 +
  33 + <view class="addimg" bindtap="addcart" data-obj="{{item}}">
  34 +
  35 + <view class="addfuhao">
  36 + <image src="/img/addfuhao.png"></image>
  37 + </view>
  38 +
  39 + </view>
  40 + </view>
  41 +
  42 +
  43 + </view>
  44 +
  45 + <view class="footbottom">
  46 + <view class="footimg" bindtap="gouwu">
  47 + <image src="/img/gouwuche.png"></image>
  48 + <view class="cartnum">{{count}}</view>
  49 + </view>
  50 + </view>
  51 +
  52 + <!-- 商品名称购买 -->
  53 +
  54 + <view class="register" wx:if="{{buyshow}}">
  55 + <view class="goodwrap">
  56 + <view class="goodname">{{shangpinming}}</view>
  57 +
  58 + <view class="selectgood">
  59 + <view class="goumaileft">请选择购买商品数量</view>
  60 +
  61 + <view class="goumairight">
  62 + <view class="maileft" bindtap="reduce">
  63 + -
  64 + </view>
  65 +
  66 + <view class="maimiddle">
  67 + <input placeholder='{{goodnum}}' value="{{goodnum}}" type="number" bindinput="entercartnum"/>
  68 +
  69 + </view>
  70 +
  71 + <view class="mairight" bindtap="add">+</view>
  72 + </view>
  73 + </view>
  74 +
  75 + <!-- 取消和确定 -->
  76 + <view class="cancelandsure">
  77 + <view class="cancel" bindtap="quxiao">取消</view>
  78 + <view class="sure" bindtap="quding">确定</view>
  79 + </view>
  80 +
  81 +
  82 + </view>
  83 + </view>
  84 +
  85 +</view>
  86 +
  1 +page{
  2 + background:#F5F5FA
  3 +}
  4 +
  5 +.cartheadimg{
  6 + width:750rpx;
  7 + height:85rpx;
  8 + font-size: 0;
  9 + position: relative
  10 +}
  11 +.carthead{
  12 + width:750rpx;
  13 + display:flex;
  14 + align-items: center;
  15 + justify-content: space-between;
  16 + position: absolute;
  17 + top:23rpx;
  18 + left:23rpx;
  19 +}
  20 +.cartheaditem{
  21 + width:110rpx;
  22 + text-align: center;
  23 + color:#fff;
  24 + font-size: 28rpx;
  25 +}
  26 +.cartbox{
  27 + padding-bottom: 105rpx;
  28 +}
  29 +.cartboxotem{
  30 + display:flex;
  31 + align-items: center;
  32 + justify-content: space-between;
  33 + padding: 20rpx 22rpx;
  34 + box-sizing: border-box
  35 +}
  36 +.cartboxotem:nth-child(2n){
  37 + background: #E9E9E9
  38 +}
  39 +.boxitemname{
  40 + width:110rpx;
  41 + text-align: center;
  42 + color:#000;
  43 + font-size: 28rpx;
  44 + word-wrap: break-word
  45 + /* overflow: hidden;
  46 + text-overflow: ellipsis;
  47 + white-space: nowrap */
  48 +}
  49 +.addimg{
  50 + width:70rpx;
  51 + height:50rpx;
  52 + display:flex;
  53 + align-items: center
  54 +
  55 +
  56 +}
  57 +.itemaddimg{
  58 + width:17rpx;
  59 + height:17rpx;
  60 +
  61 +}
  62 +.addfuhao{
  63 + width:27rpx;
  64 + height:27rpx;
  65 + font-size: 0;
  66 +}
  67 +.footbottom{
  68 + width:750rpx;
  69 + height:100rpx;
  70 + background: #fff;
  71 + position: fixed;
  72 + bottom:0;
  73 + left:0;
  74 +}
  75 +.footimg{
  76 + width:132rpx;
  77 + height:132rpx;
  78 + font-size: 0;
  79 + position: absolute;
  80 + top:-53rpx;
  81 + left:15rpx;
  82 +}
  83 +.cartnum{
  84 + width:40rpx;
  85 + height:40rpx;
  86 + border-radius: 50%;
  87 + background: #FB8423;
  88 + text-align: center;
  89 + line-height: 40rpx;
  90 + position: absolute;
  91 + top:0;
  92 + right:0;
  93 + color:#fff;
  94 + font-size: 26rpx;
  95 +}
  96 +.selectgood{
  97 + display:flex;
  98 + align-items: center;
  99 + justify-content: space-between;
  100 + margin-top:63rpx;
  101 +}
  102 +
  103 +.goodwrap{
  104 + width:705rpx;
  105 + /* height:365rpx; */
  106 + background: #fff;
  107 + border-radius: 20rpx;
  108 + position: absolute;
  109 + bottom:130rpx;
  110 + left:22rpx;
  111 + padding: 23rpx 34rpx;
  112 + box-sizing: border-box;
  113 +}
  114 +.goodname{
  115 + color:#141414;
  116 + font-size: 32rpx;
  117 + font-weight: bold;
  118 + margin-top:30rpx;
  119 +}
  120 +.goumairight{
  121 + display:flex;
  122 + align-items: center;
  123 +}
  124 +.goumaileft{
  125 + color:#141414;
  126 + font-size: 24rpx;
  127 +}
  128 +.maileft{
  129 + width:44rpx;
  130 + height:35rpx;
  131 + border:1rpx solid #f5f5f5;
  132 + text-align: center;
  133 + line-height: 35rpx;
  134 + color:#141414;
  135 + font-size: 22rpx;
  136 + border-top-left-radius: 16rpx;
  137 + border-bottom-left-radius: 16rpx;
  138 +}
  139 +.maimiddle{
  140 + width:185rpx;
  141 + height:35rpx;
  142 + line-height: 35rpx;
  143 + border:1rpx solid #f5f5f5;
  144 + border-left:none;
  145 + text-align: center;
  146 + display:flex;
  147 + align-items: center;
  148 +
  149 + color:#141414;
  150 + font-size: 22rpx;
  151 +}
  152 +.maimiddle input{
  153 + /* height:35rpx!important;
  154 + line-height: 35rpx;
  155 + min-height:35rpx!important;
  156 + border:none;
  157 + outline:none;
  158 + display:flex;
  159 + align-items: center;
  160 + padding-top: 2rpx;
  161 + box-sizing: border-box */
  162 +
  163 +}
  164 +.mairight{
  165 + width:44rpx;
  166 + height:35rpx;
  167 + border:1rpx solid #f5f5f5;
  168 + text-align: center;
  169 + line-height: 35rpx;
  170 + border-left:none;
  171 + color:#FF5A00;
  172 + font-size: 22rpx;
  173 + border-top-right-radius: 16rpx;
  174 + border-bottom-right-radius: 16rpx;
  175 +}
  176 +.cancelandsure{
  177 + display:flex;
  178 + align-items: center;
  179 + justify-content: space-between;
  180 + margin-top:54rpx;
  181 +}
  182 +.cancel{
  183 + width:243rpx;
  184 + height:83rpx;
  185 + background: #E9E9E9;
  186 + color:#141414;
  187 + font-size: 28rpx;
  188 + text-align: center;
  189 + line-height: 83rpx;
  190 + border-radius: 20rpx;
  191 +}
  192 +.sure{
  193 + width:369rpx;
  194 + height:83rpx;
  195 + background: #2781FB;
  196 + color:#fff;
  197 + font-size: 28rpx;
  198 + text-align: center;
  199 + line-height: 83rpx;
  200 + border-radius: 20rpx;
  201 +}
  202 +.cartkongimg{
  203 + width:399rpx;
  204 + height:491rpx;
  205 + font-size: 0;
  206 + margin:179rpx auto 0;
  207 +
  208 +}
  209 +.konggou{
  210 + color:#141414;
  211 + font-size: 32rpx;
  212 + text-align: center;
  213 + margin-top:57rpx;
  214 +}
  1 +const app=getApp();
  2 +
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + cartlist:[],
  10 + allselect:false,
  11 + cartidarr:[],
  12 + cartnumarr:[],
  13 + numcart:'',
  14 + ti:1
  15 + },
  16 +
  17 + /**
  18 + * 生命周期函数--监听页面加载
  19 + */
  20 + onLoad: function (options) {
  21 +
  22 + },
  23 +
  24 +
  25 +
  26 + //获取购物车列表
  27 + getcartlsit(){
  28 + let url ='index/getCarList'
  29 +
  30 + app.post(url, '', 'get').then((res) => {
  31 + console.log(res);
  32 +
  33 + for(var obj of res){
  34 + obj.select=false
  35 + }
  36 +
  37 +
  38 + this.setData({
  39 + cartlist:res
  40 + })
  41 +
  42 + console.log(this.data.cartlist)
  43 +
  44 +
  45 + }).catch((err) => {
  46 +
  47 + })
  48 + },
  49 + nosel(){
  50 +
  51 + },
  52 + //输入购物车的数量
  53 + entercartnum(e){
  54 + let id=e.currentTarget.dataset.id;
  55 + console.log(id)
  56 + let newcartlist = this.data.cartlist;
  57 + let newcartnumarr = this.data.cartnumarr;
  58 +
  59 +
  60 + for (var obj of newcartlist){
  61 + if(obj.goods_id==id){
  62 + obj.count=e.detail.value;
  63 + this.setData({
  64 + numcart:obj.count
  65 + })
  66 + }
  67 + }
  68 +
  69 + for (var obj of newcartnumarr) {
  70 + if (obj.id == id) {
  71 + obj.num = this.data.numcart;
  72 +
  73 + }
  74 + }
  75 +
  76 + this.setData({
  77 + cartlist: newcartlist,
  78 + cartnumarr: newcartnumarr
  79 + })
  80 +
  81 + },
  82 +
  83 + //增加购物车的数量
  84 + addcart(e){
  85 + let id=e.currentTarget.dataset.id;
  86 + let newcartlist=this.data.cartlist;
  87 + let newcartnumarr=this.data.cartnumarr;
  88 + for(var obj of newcartlist){
  89 + if(obj.goods_id==id){
  90 + obj.count = Number(obj.count)+1;
  91 + this.setData({
  92 + numcart:obj.count
  93 + })
  94 + }
  95 + }
  96 +
  97 + for(var obj of newcartnumarr){
  98 + if(obj.id==id){
  99 + obj.num=this.data.numcart;
  100 +
  101 + }
  102 + }
  103 +
  104 + this.setData({
  105 + cartlist: newcartlist,
  106 + cartnumarr: newcartnumarr
  107 + })
  108 +
  109 +
  110 +
  111 +
  112 +
  113 + },
  114 + //减少购物车数量
  115 + reducecart(e){
  116 + let id = e.currentTarget.dataset.id;
  117 + let newcartlist = this.data.cartlist;
  118 + let newcartnumarr=this.data.cartnumarr;
  119 + for (var obj of newcartlist) {
  120 + if (obj.goods_id == id) {
  121 + if (obj.count==1){
  122 + obj.count=1;
  123 + this.setData({
  124 + numcart: obj.count
  125 + })
  126 +
  127 + }else{
  128 + obj.count = Number(obj.count) -1;
  129 + this.setData({
  130 + numcart: obj.count
  131 + })
  132 +
  133 + }
  134 +
  135 + }
  136 + }
  137 +
  138 + for (var obj of newcartnumarr) {
  139 + if (obj.id == id) {
  140 + obj.num = this.data.numcart;
  141 +
  142 + }
  143 + }
  144 +
  145 +
  146 + this.setData({
  147 + cartlist: newcartlist,
  148 + cartnumarr:newcartnumarr,
  149 + })
  150 +
  151 + console.log(this.data.cartnumarr)
  152 + },
  153 +
  154 + //删除购物车
  155 + delcart(e){
  156 + console.log(e)
  157 +
  158 + let id=e.currentTarget.dataset.id;
  159 + let url = 'index/delCar';
  160 + let param={
  161 + goods_id:id
  162 + }
  163 +
  164 + app.post(url, param, 'get').then((res) => {
  165 + console.log(res);
  166 +
  167 + wx.showToast({
  168 + title: '删除成功',
  169 + icon:"none"
  170 + })
  171 +
  172 + this.getcartlsit()
  173 +
  174 +
  175 +
  176 + }).catch((err) => {
  177 +
  178 + })
  179 + },
  180 + //选择购物车
  181 + chosecart(e){
  182 + let id=e.currentTarget.dataset.id;
  183 +
  184 + let newcartlist = this.data.cartlist;
  185 + let newcartidarr=this.data.cartidarr;
  186 + let newcartnumarr=this.data.cartnumarr;
  187 + let opt={}
  188 + for(var obj of newcartlist){
  189 + if(obj.goods_id==id){
  190 + obj.select=!obj.select;
  191 + if(obj.select==true){
  192 + opt.id = obj.goods_id;
  193 + opt.num=obj.count;
  194 + newcartidarr.push(obj.goods_id);
  195 + newcartnumarr.push(opt)
  196 + }else{
  197 + let newcartidarr=this.data.cartidarr;
  198 + for(var i=0;i<newcartidarr.length;i++){
  199 + if (newcartidarr[i]==id){
  200 + newcartidarr.splice(i,1);
  201 +
  202 + }
  203 + }
  204 +
  205 + for (var j = 0; j < newcartnumarr.length; j++) {
  206 + if (newcartnumarr[j].num == obj.count) {
  207 + newcartnumarr.splice(j, 1);
  208 +
  209 + }
  210 + }
  211 + }
  212 +
  213 + }
  214 + }
  215 +
  216 + if (newcartidarr.length==this.data.cartlist.length){
  217 + this.setData({
  218 + allselect:true
  219 + })
  220 + }else{
  221 + this.setData({
  222 + allselect: false
  223 + })
  224 + }
  225 +
  226 + this.setData({
  227 + cartidarr:newcartidarr,
  228 + cartlist:newcartlist,
  229 + cartnumarr:newcartnumarr
  230 + })
  231 +
  232 + console.log(this.data.cartnumarr)
  233 + },
  234 +
  235 + //全选购物车
  236 + quanxuan(){
  237 + this.setData({
  238 + allselect: !this.data.allselect
  239 + })
  240 +
  241 + if(this.data.allselect==true){
  242 + let newcartlist = this.data.cartlist;
  243 +
  244 +
  245 + let newcartidarr = [];
  246 + let newcartnumarr=[];
  247 +
  248 +
  249 + for(var obj of newcartlist){
  250 + let opt = {};
  251 + console.log(obj)
  252 +
  253 + obj.select=true;
  254 + newcartidarr.push(obj.goods_id);
  255 + opt.id = obj.goods_id;
  256 + opt.num = obj.count;
  257 + console.log(opt)
  258 + newcartnumarr.push(opt)
  259 + }
  260 +
  261 + this.setData({
  262 + cartlist:newcartlist,
  263 + cartidarr:newcartidarr,
  264 + cartnumarr:newcartnumarr
  265 + })
  266 +
  267 +
  268 + }else{
  269 + let newcartlist = this.data.cartlist;
  270 + for(var obj of newcartlist){
  271 + obj.select=false
  272 + }
  273 + this.setData({
  274 + cartidarr: [],
  275 + cartnumarr:[],
  276 + cartlist:newcartlist
  277 + })
  278 + }
  279 +
  280 +
  281 + },
  282 +
  283 + tijaiodingdan() {
  284 + let that=this;
  285 + if (that.data.cartidarr.length==0){
  286 + wx.showToast({
  287 + title: '请选择购买商品',
  288 + icon:'none'
  289 + })
  290 +
  291 + return false
  292 + }else{
  293 + that.setData({
  294 + ti:''
  295 + })
  296 + console.log(that.data.ti)
  297 + let newcartnumarr = that.data.cartnumarr;
  298 + console.log(newcartnumarr)
  299 + let numarr = [];
  300 + for (var obj of newcartnumarr) {
  301 + numarr.push(obj.num)
  302 + }
  303 + numarr = numarr.join(",");
  304 + let newcartidarr = that.data.cartidarr;
  305 + newcartidarr = newcartidarr.join(",");
  306 + console.log(numarr);
  307 +
  308 + let url = 'index/addOrder';
  309 + let param = {
  310 + goods_id: newcartidarr,
  311 + amount: numarr
  312 + }
  313 +
  314 + app.post(url, param, 'post').then((res) => {
  315 + console.log(res);
  316 + wx.setStorageSync('orderarr', res.data);
  317 + wx.setStorageSync('total_price', res.total_price)
  318 + wx.showToast({
  319 + title: '提交订单成功',
  320 + icon: 'none'
  321 + })
  322 +
  323 + setTimeout(function () {
  324 + wx.navigateTo({
  325 + url: '/pages/orderdetail/orderdetail',
  326 + })
  327 + }, 1000)
  328 +
  329 +
  330 +
  331 + }).catch((err) => {
  332 +
  333 + })
  334 + }
  335 +
  336 +
  337 + },
  338 + //删除购物车
  339 + shanchucart(){
  340 + let that=this;
  341 + let newcartidarr=this.data.cartidarr;
  342 + if(newcartidarr.length==0){
  343 + wx.showToast({
  344 + title: '请选择要删除的商品',
  345 + icon:'none'
  346 + })
  347 +
  348 + return false
  349 + }
  350 +
  351 + let url = 'index/delCar';
  352 + let param = {
  353 + goods_id: newcartidarr.join(","),
  354 +
  355 + }
  356 +
  357 + app.post(url, param, 'get').then((res) => {
  358 + console.log(res);
  359 + wx.showToast({
  360 + title: '删除购物车成功',
  361 + icon: 'none'
  362 + })
  363 +
  364 +
  365 + that.getcartlsit();
  366 +
  367 +
  368 +
  369 + }).catch((err) => {
  370 +
  371 + })
  372 +
  373 + },
  374 +
  375 + /**
  376 + * 生命周期函数--监听页面初次渲染完成
  377 + */
  378 + onReady: function () {
  379 +
  380 + },
  381 +
  382 + /**
  383 + * 生命周期函数--监听页面显示
  384 + */
  385 + onShow: function () {
  386 + this.setData({
  387 + cartlist: [],
  388 + allselect: false,
  389 + cartidarr: [],
  390 + cartnumarr: [],
  391 + })
  392 + this.getcartlsit()
  393 + },
  394 +
  395 + /**
  396 + * 生命周期函数--监听页面隐藏
  397 + */
  398 + onHide: function () {
  399 +
  400 + },
  401 +
  402 + /**
  403 + * 生命周期函数--监听页面卸载
  404 + */
  405 + onUnload: function () {
  406 +
  407 + },
  408 +
  409 + /**
  410 + * 页面相关事件处理函数--监听用户下拉动作
  411 + */
  412 + onPullDownRefresh: function () {
  413 +
  414 + },
  415 +
  416 + /**
  417 + * 页面上拉触底事件的处理函数
  418 + */
  419 + onReachBottom: function () {
  420 +
  421 + },
  422 +
  423 + /**
  424 + * 用户点击右上角分享
  425 + */
  426 + onShareAppMessage: function () {
  427 +
  428 + }
  429 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="gouwuche">购物车</view>
  2 +
  3 +<view class="cartkong" wx:if="{{cartlist.length==0}}">
  4 + <view class="cartkongimg">
  5 + <image src="/img/cartimg.png"></image>
  6 + </view>
  7 +
  8 + <view class="konggou">购物车空空如也</view>
  9 +</view>
  10 +
  11 +<view class="gouwubox" wx:else>
  12 +
  13 +
  14 + <view class="gouwuitem" wx:for="{{cartlist}}" wx:key="" bindtap="chosecart" data-id="{{item.goods_id}}">
  15 +
  16 +
  17 + <view class="gouitemleft" wx:if="{{item.select==true}}" >
  18 +
  19 + <image src="/img/xuanzhong.png"></image>
  20 + </view>
  21 +
  22 + <view class="gouitemleft" wx:else>
  23 +
  24 + <image src="/img/noselect.png"></image>
  25 + </view>
  26 +
  27 + <view class="goumairight">
  28 +
  29 + <view class="goumaitop">
  30 + <view class="goumiddletop">物料编号 : {{item.number}}</view>
  31 +
  32 + <view class="shanimg" catchtap="delcart" data-id="{{item.goods_id}}">
  33 + <image src="/img/delshan.png"></image>
  34 + </view>
  35 + </view>
  36 + <view class="goumiddletop">商品名称 : {{item.name}}</view>
  37 + <view class="goumiddletop">开发票品名 : {{item.invoice_name}}</view>
  38 +
  39 + <view class="kaimoney">
  40 + <view class="singleprice">¥{{item.price}}</view>
  41 + <view class="goumaishu">
  42 + <view class="goumaishuleft" catchtap="reducecart" data-id="{{item.goods_id}}">-</view>
  43 + <view class="goumaishumiddle" catchtap='nosel'>
  44 +
  45 + <input placeholder='{{item.count}}' value="{{item.count}}" bindinput="entercartnum" data-id="{{item.goods_id}}"/>
  46 +
  47 +
  48 +
  49 + </view>
  50 + <view class="goumaishuright" catchtap="addcart" data-id="{{item.goods_id}}">+</view>
  51 + </view>
  52 +
  53 + </view>
  54 + </view>
  55 +
  56 + </view>
  57 +
  58 +
  59 +</view>
  60 +<view class="orderfoot">
  61 + <view class="orderfoottop">
  62 + <view class="footleft" bindtap="quanxuan">
  63 + <view class="footleftimg" wx:if="{{allselect==true}}" >
  64 + <image src="/img/xuanzhong.png"></image>
  65 + </view>
  66 +
  67 + <view class="footleftimg" wx:else >
  68 + <image src="/img/noselect.png"></image>
  69 + </view>
  70 +
  71 + <view class="quanxuan">全选</view>
  72 + </view>
  73 +
  74 + <view class="footright" catchtap="shanchucart">删除</view>
  75 + </view>
  76 +
  77 + <view class="orderbottom" bindtap="tijaiodingdan" wx:if="{{ti==1}}">
  78 + 提交订单
  79 + </view>
  80 + <view class="orderbottom" wx:else>
  81 + 提交订单
  82 + </view>
  83 +</view>
  1 +page {
  2 + background: #f5f5fa;
  3 +}
  4 +
  5 +.gouwuche {
  6 + color: #141414;
  7 + font-size: 40rpx;
  8 + font-weight: bold;
  9 + padding: 34rpx 23rpx 10rpx 23rpx;
  10 + box-sizing: border-box;
  11 +}
  12 +
  13 +.gouwuitem {
  14 + padding: 34rpx 46rpx 34rpx 18rpx;
  15 + box-sizing: border-box;
  16 + background: #fff;
  17 + width: 702rpx;
  18 + margin: 28rpx auto 0;
  19 + border-radius: 28rpx;
  20 + display: flex;
  21 + align-items: center;
  22 +}
  23 +
  24 +.goumaitop {
  25 + display: flex;
  26 + align-items: center;
  27 + justify-content: space-between;
  28 +}
  29 +
  30 +.kaimoney {
  31 + display: flex;
  32 + align-items: center;
  33 + justify-content: space-between;
  34 + margin-top:10rpx;
  35 +}
  36 +
  37 +.gouitemleft {
  38 + width: 22rpx;
  39 + height: 22rpx;
  40 + font-size: 0;
  41 +}
  42 +
  43 +.goumairight {
  44 + flex: 1;
  45 + margin-left: 40rpx;
  46 +}
  47 +
  48 +.shanimg {
  49 + width: 26rpx;
  50 + height: 31rpx;
  51 + font-size: 0;
  52 +}
  53 +
  54 +.gouitemtop {
  55 + display: flex;
  56 + align-items: center;
  57 + justify-content: space-between;
  58 +}
  59 +
  60 +.goumaishu {
  61 + display: flex;
  62 + align-items: center;
  63 +}
  64 +
  65 +.goumaishuleft {
  66 + width: 44rpx;
  67 + height: 31rpx;
  68 + border: 1rpx solid #f5f5f5;
  69 + border-top-left-radius: 16rpx;
  70 + border-bottom-left-radius: 16rpx;
  71 + text-align: center;
  72 + line-height: 31rpx;
  73 + border-right: none;
  74 + color: #141414;
  75 + font-size: 24rpx;
  76 +}
  77 +
  78 +.goumaishumiddle {
  79 + width: 161rpx;
  80 + height: 31rpx;
  81 + line-height: 31rpx;
  82 + border: 1rpx solid #f5f5f5;
  83 + text-align: center;
  84 +
  85 + color: #141414;
  86 + font-size: 24rpx;
  87 + border-right: none;
  88 + display:flex;
  89 + align-items: center
  90 +}
  91 +.goumaishumiddle input{
  92 + /* height:31rpx!important;
  93 + min-height:31rpx!important;
  94 + line-height: 31rpx;
  95 + border:none;
  96 + outline:none;
  97 + display:flex;
  98 + align-items: center */
  99 +}
  100 +.goumaishuright {
  101 + width: 44rpx;
  102 + height: 31rpx;
  103 + border: 1rpx solid #f5f5f5;
  104 + text-align: center;
  105 + line-height: 31rpx;
  106 + border-right: none;
  107 + color: #141414;
  108 + font-size: 24rpx;
  109 + border-top-right-radius: 16rpx;
  110 + border-bottom-right-radius: 16rpx;
  111 +}
  112 +
  113 +.goumiddletop {
  114 + color: #141414;
  115 + font-size: 26rpx;
  116 + margin-top: 10rpx;
  117 +}
  118 +
  119 +.singleprice {
  120 + color: #e60000;
  121 + font-size: 26rpx;
  122 +}
  123 +.gouwubox{
  124 + padding-bottom: 200rpx;
  125 +}
  126 +
  127 +.orderfoot {
  128 + position: fixed;
  129 + bottom: 0;
  130 + left: 0;
  131 +}
  132 +
  133 +.orderfoottop {
  134 + width: 750rpx;
  135 + display: flex;
  136 + align-items: center;
  137 + justify-content: space-between;
  138 + padding: 31rpx 42rpx;
  139 + box-sizing: border-box;
  140 + background: #e9e9e9;
  141 +}
  142 +
  143 +.footleft {
  144 + display: flex;
  145 + align-items: center;
  146 +}
  147 +.footleftimg{
  148 + width:22rpx;
  149 + height:22rpx;
  150 + font-size: 0
  151 +}
  152 +.quanxuan{
  153 + color:#141414;
  154 + font-size: 26rpx;
  155 + margin-left:20rpx;
  156 +}
  157 +.footright{
  158 + color:#DA0000;
  159 + font-size: 24rpx;
  160 +}
  161 +.orderbottom{
  162 + width:750rpx;
  163 + height:88rpx;
  164 + background: #2781FB;
  165 + color:#fff;
  166 + font-size: 24rpx;
  167 + text-align: center;
  168 + line-height: 88rpx;
  169 +
  170 +}
  171 +
  172 +.cartkongimg{
  173 + width:399rpx;
  174 + height:491rpx;
  175 + font-size: 0;
  176 + margin:179rpx auto 0;
  177 +
  178 +}
  179 +.konggou{
  180 + color:#141414;
  181 + font-size: 32rpx;
  182 + text-align: center;
  183 + margin-top:57rpx;
  184 +}
  1 +//index.js
  2 +//获取应用实例
  3 +const app = getApp()
  4 +
  5 +Page({
  6 + data: {
  7 + motto: 'Hello World',
  8 + userInfo: {},
  9 + hasUserInfo: false,
  10 + canIUse: wx.canIUse('button.open-type.getUserInfo')
  11 + },
  12 + //事件处理函数
  13 + bindViewTap: function() {
  14 + wx.navigateTo({
  15 + url: '../logs/logs'
  16 + })
  17 + },
  18 + onLoad: function () {
  19 + if (app.globalData.userInfo) {
  20 + this.setData({
  21 + userInfo: app.globalData.userInfo,
  22 + hasUserInfo: true
  23 + })
  24 + } else if (this.data.canIUse){
  25 + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
  26 + // 所以此处加入 callback 以防止这种情况
  27 + app.userInfoReadyCallback = res => {
  28 + this.setData({
  29 + userInfo: res.userInfo,
  30 + hasUserInfo: true
  31 + })
  32 + }
  33 + } else {
  34 + // 在没有 open-type=getUserInfo 版本的兼容处理
  35 + wx.getUserInfo({
  36 + success: res => {
  37 + app.globalData.userInfo = res.userInfo
  38 + this.setData({
  39 + userInfo: res.userInfo,
  40 + hasUserInfo: true
  41 + })
  42 + }
  43 + })
  44 + }
  45 + },
  46 + getUserInfo: function(e) {
  47 + console.log(e)
  48 + app.globalData.userInfo = e.detail.userInfo
  49 + this.setData({
  50 + userInfo: e.detail.userInfo,
  51 + hasUserInfo: true
  52 + })
  53 + }
  54 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<!--index.wxml-->
  2 +<view class="container">
  3 + <view class="userinfo">
  4 + <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
  5 + <block wx:else>
  6 + <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
  7 + <text class="userinfo-nickname">{{userInfo.nickName}}</text>
  8 + </block>
  9 + </view>
  10 + <view class="usermotto">
  11 + <text class="user-motto">{{motto}}</text>
  12 + </view>
  13 +</view>
  1 +/**index.wxss**/
  2 +.userinfo {
  3 + display: flex;
  4 + flex-direction: column;
  5 + align-items: center;
  6 +}
  7 +
  8 +.userinfo-avatar {
  9 + width: 128rpx;
  10 + height: 128rpx;
  11 + margin: 20rpx;
  12 + border-radius: 50%;
  13 +}
  14 +
  15 +.userinfo-nickname {
  16 + color: #aaa;
  17 +}
  18 +
  19 +.usermotto {
  20 + margin-top: 200px;
  21 +}
  1 +// pages/login/login.js
  2 +
  3 +const app = getApp()
  4 +Page({
  5 +
  6 + /**
  7 + * 页面的初始数据
  8 + */
  9 + data: {
  10 + loginshow: false,
  11 + errmima: false,
  12 + zhanghao: "",
  13 + mima: ''
  14 + },
  15 +
  16 + /**
  17 + * 生命周期函数--监听页面加载
  18 + */
  19 + onLoad: function(options) {
  20 +
  21 + },
  22 +
  23 + //输入账号
  24 + enterzhanghao(e) {
  25 + this.setData({
  26 + zhanghao: e.detail.value
  27 + })
  28 + },
  29 + //输入密码
  30 + entermima(e) {
  31 + this.setData({
  32 + mima: e.detail.value
  33 + })
  34 + },
  35 +
  36 + //登录页面
  37 + login() {
  38 +
  39 + // var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
  40 +
  41 + // if (this.data.zhanghao != '') {
  42 + // if (!reg.test(this.data.zhanghao)) {
  43 + // wx.showToast({
  44 + // title: '请输入正确的邮箱格式',
  45 + // icon: 'none'
  46 + // })
  47 +
  48 + // return false
  49 + // }
  50 + // }
  51 +
  52 +
  53 +
  54 + let url = 'user/login'
  55 + let param = {
  56 + mobile: this.data.zhanghao,
  57 + password: this.data.mima
  58 + }
  59 +
  60 + app.post(url, param, 'post').then((res) => {
  61 + console.log(res);
  62 +
  63 + wx.setStorageSync("token", res.token);
  64 + wx.setStorageSync("username", res.username)
  65 +
  66 + setTimeout(function() {
  67 + wx.switchTab({
  68 + url: '/pages/sousuo/sousuo',
  69 + })
  70 + }, 1000)
  71 +
  72 + }).catch((err) => {
  73 + console.log(err)
  74 + wx.showToast({
  75 + title: err.data.msg,
  76 + icon: 'none'
  77 + })
  78 +
  79 + })
  80 +
  81 + },
  82 + hideloginwrap() {
  83 + this.setData({
  84 + loginshow: false
  85 + })
  86 + },
  87 + /**
  88 + * 生命周期函数--监听页面初次渲染完成
  89 + */
  90 + onReady: function() {
  91 +
  92 + },
  93 +
  94 + /**
  95 + * 生命周期函数--监听页面显示
  96 + */
  97 + onShow: function() {
  98 +
  99 + },
  100 +
  101 + /**
  102 + * 生命周期函数--监听页面隐藏
  103 + */
  104 + onHide: function() {
  105 +
  106 + },
  107 +
  108 + /**
  109 + * 生命周期函数--监听页面卸载
  110 + */
  111 + onUnload: function() {
  112 +
  113 + },
  114 +
  115 + /**
  116 + * 页面相关事件处理函数--监听用户下拉动作
  117 + */
  118 + onPullDownRefresh: function() {
  119 +
  120 + },
  121 +
  122 + /**
  123 + * 页面上拉触底事件的处理函数
  124 + */
  125 + onReachBottom: function() {
  126 +
  127 + },
  128 +
  129 + /**
  130 + * 用户点击右上角分享
  131 + */
  132 + onShareAppMessage: function() {
  133 +
  134 + }
  135 +})
  1 +{
  2 + "usingComponents": {},
  3 + "navigationBarTitleText": "中源生物"
  4 +}
  1 +<view class="page">
  2 + <image src='/img/bejing.png'></image>
  3 +
  4 + <view class="baibeijing">
  5 + <view class="shengwuimg">
  6 + <image src="/img/logo.png"></image>
  7 + </view>
  8 +
  9 + <view class="shuruhao">
  10 + <input placeholder='请输入邮箱' placeholder-class='enterzhang' type="text" value="{{zhanghao}}" bindinput="enterzhanghao"/>
  11 + </view>
  12 + <view class="shuruhao shumima">
  13 + <input placeholder='请输入密码' placeholder-class='enterzhang' type="password" value="{{mima}}" bindinput="entermima"/>
  14 + </view>
  15 +
  16 + <view class="dengluniu" bindtap="login">登录</view>
  17 + </view>
  18 +
  19 +
  20 +</view>
  21 +
  22 +<view class="register" wx:if="{{loginshow}}">
  23 + <view class="loginwrap" bindtap="hideloginwrap">
  24 + <image src="/img/dengluchenggong.png"></image>
  25 + <view class="loginsuccess">登录成功</view>
  26 + </view>
  27 +</view>
  28 +
  29 +<!-- 账号或密码错误 -->
  30 +
  31 +<view class="zhanghaoregister" wx:if="{{errmima}}">
  32 + <view class="zhanghaowrap">*账号或密码错误</view>
  33 +</view>
  1 +/* pages/login/login.wxss */
  2 +
  3 +page {
  4 + width: 100%;
  5 + height: 100%;
  6 + overflow-y: hidden;
  7 +}
  8 +
  9 +.page {
  10 + width: 100%;
  11 + height: 100%;
  12 +}
  13 +
  14 +image {
  15 + width: 100%;
  16 + height: 100%;
  17 +}
  18 +
  19 +.shengwuimg {
  20 + width: 421rpx;
  21 + height: 134rpx;
  22 + font-size: 0;
  23 + margin: 116rpx auto 0;
  24 +}
  25 +
  26 +.baibeijing {
  27 + width: 634rpx;
  28 + height: 847rpx;
  29 + background: rgba(253, 253, 254, 1);
  30 + box-shadow: 0rpx 7rpx 8rpx 0rpx rgba(25, 103, 175, 0.08);
  31 + border-radius: 28rpx;
  32 + position: absolute;
  33 + top: 167rpx;
  34 + left: 61rpx;
  35 +}
  36 +
  37 +.shuruhao {
  38 + width: 479rpx;
  39 + height: 78rpx;
  40 + background: rgba(241, 241, 241, 1);
  41 + border: 1px solid rgba(228, 228, 228, 1);
  42 + border-radius: 39rpx;
  43 + margin: 111rpx auto 0;
  44 + padding: 0 37rpx;
  45 + box-sizing: border-box;
  46 + color: #bbb;
  47 + font-size: 28rpx;
  48 +}
  49 +
  50 +.shuruhao input {
  51 + width: 100%;
  52 + height: 70rpx;
  53 + background: rgba(241, 241, 241, 1);
  54 + border: none;
  55 + outline: none;
  56 + border-radius: 39rpx;
  57 + color: #bbb;
  58 + font-size: 28rpx;
  59 +}
  60 +
  61 +.enterzhang {
  62 + color: #bbb;
  63 + font-size: 28rpx;
  64 +}
  65 +
  66 +.shumima {
  67 + margin-top: 28rpx;
  68 +}
  69 +
  70 +.dengluniu {
  71 + width: 290rpx;
  72 + height: 85rpx;
  73 + background: #30a8ff;
  74 + border-radius: 28rpx;
  75 + text-align: center;
  76 + line-height: 85rpx;
  77 + margin: 123rpx auto 0;
  78 + color: #fff;
  79 +}
  80 +
  81 +.loginwrap {
  82 + width: 354rpx;
  83 + height: 374rpx;
  84 + font-size: 0;
  85 + margin: 358rpx auto 0;
  86 + position: relative;
  87 +}
  88 +
  89 +.loginsuccess {
  90 + color: #2c2c2c;
  91 + font-size: 28rpx;
  92 + position: absolute;
  93 + top: 197rpx;
  94 + left: 126rpx;
  95 +}
  96 +
  97 +.zhanghaoregister {
  98 + width: 100%;
  99 + height: 100%;
  100 + background-color: rgba(0, 0, 0, 0.5);
  101 + position: fixed;
  102 + top: 0;
  103 + left: 0;
  104 + right: 0;
  105 + z-index: 5;
  106 +}
  107 +.zhanghaowrap{
  108 + width:344rpx;
  109 + height:74rpx;
  110 + border-radius: 28rpx;
  111 + background: #fff;
  112 + display:flex;
  113 + align-items: center;
  114 + justify-content: center;
  115 + position: absolute;
  116 + top:60rpx;
  117 + left:203rpx;
  118 +}
  1 +//logs.js
  2 +const util = require('../../utils/util.js')
  3 +
  4 +Page({
  5 + data: {
  6 + logs: []
  7 + },
  8 + onLoad: function () {
  9 + this.setData({
  10 + logs: (wx.getStorageSync('logs') || []).map(log => {
  11 + return util.formatTime(new Date(log))
  12 + })
  13 + })
  14 + }
  15 +})
  1 +{
  2 + "navigationBarTitleText": "查看启动日志",
  3 + "usingComponents": {}
  4 +}
  1 +<!--logs.wxml-->
  2 +<view class="container log-list">
  3 + <block wx:for="{{logs}}" wx:for-item="log">
  4 + <text class="log-item">{{index + 1}}. {{log}}</text>
  5 + </block>
  6 +</view>
  1 +.log-list {
  2 + display: flex;
  3 + flex-direction: column;
  4 + padding: 40rpx;
  5 +}
  6 +.log-item {
  7 + margin: 10rpx;
  8 +}
  1 +// pages/mine/mine.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + yonghuname:''
  9 + },
  10 +
  11 + /**
  12 + * 生命周期函数--监听页面加载
  13 + */
  14 + onLoad: function (options) {
  15 +
  16 + },
  17 + //我的客户
  18 + mykehu(){
  19 +
  20 + let token = wx.getStorageSync("token");
  21 + if (token == '') {
  22 + wx.showToast({
  23 + title: '请先登录',
  24 + icon: 'none'
  25 + })
  26 +
  27 + setTimeout(function () {
  28 + wx.navigateTo({
  29 + url: '/pages/login/login',
  30 + })
  31 + }, 1500)
  32 + }else{
  33 + wx.navigateTo({
  34 + url: '/pages/mykehu/mykehu',
  35 + })
  36 + }
  37 +
  38 +
  39 + },
  40 + //我的订单
  41 + myorder(){
  42 + let token = wx.getStorageSync("token");
  43 + if (token == '') {
  44 + wx.showToast({
  45 + title: '请先登录',
  46 + icon: 'none'
  47 + })
  48 +
  49 + setTimeout(function () {
  50 + wx.navigateTo({
  51 + url: '/pages/login/login',
  52 + })
  53 + }, 1500)
  54 + }else{
  55 + wx.navigateTo({
  56 + url: '/pages/myorder/myorder',
  57 + })
  58 + }
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 生命周期函数--监听页面初次渲染完成
  64 + */
  65 + onReady: function () {
  66 +
  67 + },
  68 +
  69 + /**
  70 + * 生命周期函数--监听页面显示
  71 + */
  72 + onShow: function () {
  73 + let username=wx.getStorageSync("username");
  74 + if(username==''){
  75 + this.setData({
  76 + yonghuname:'暂无'
  77 + })
  78 + }else{
  79 + this.setData({
  80 + yonghuname:username
  81 + })
  82 + }
  83 + },
  84 +
  85 + /**
  86 + * 生命周期函数--监听页面隐藏
  87 + */
  88 + onHide: function () {
  89 +
  90 + },
  91 +
  92 + /**
  93 + * 生命周期函数--监听页面卸载
  94 + */
  95 + onUnload: function () {
  96 +
  97 + },
  98 +
  99 + /**
  100 + * 页面相关事件处理函数--监听用户下拉动作
  101 + */
  102 + onPullDownRefresh: function () {
  103 +
  104 + },
  105 +
  106 + /**
  107 + * 页面上拉触底事件的处理函数
  108 + */
  109 + onReachBottom: function () {
  110 +
  111 + },
  112 +
  113 + /**
  114 + * 用户点击右上角分享
  115 + */
  116 + onShareAppMessage: function () {
  117 +
  118 + }
  119 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="myname">{{yonghuname}}</view>
  2 +
  3 +
  4 +<view class="minebox">
  5 + <view class="mineitem" bindtap="mykehu">
  6 + <view class="mineitemleft">我的客户</view>
  7 + <view class="mineitemright">
  8 + <image src="/img/yourow.png"></image>
  9 + </view>
  10 + </view>
  11 + <view class="mineitem" bindtap="myorder">
  12 + <view class="mineitemleft">我的订单</view>
  13 + <view class="mineitemright">
  14 + <image src="/img/yourow.png"></image>
  15 + </view>
  16 + </view>
  17 +
  18 +</view>
  1 +page{
  2 + background: #F5F5FA;
  3 +}
  4 +
  5 +.minebox{
  6 + width:702rpx;
  7 + background: #fff;
  8 + margin:179rpx auto 0;
  9 + border-radius: 28rpx;
  10 +}
  11 +.myname{
  12 + color:#141414;
  13 + font-size: 34rpx;
  14 + text-align: center;
  15 + margin-top:164rpx;
  16 + font-weight: bold;
  17 +}
  18 +.mineitem{
  19 + display:flex;
  20 + align-items: center;
  21 + justify-content: space-between;
  22 + padding: 24rpx 36rpx;
  23 + box-sizing: border-box
  24 +}
  25 +.mineitemright{
  26 + width:13rpx;
  27 + height:28rpx;
  28 + font-size: 0
  29 +}
  1 +// pages/mykehu/mykehu.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + kehulist:[],
  10 + page:1,
  11 + morenkehu:'',
  12 + showmoren:true,
  13 + letter: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","#"],
  14 + cityListId:'',
  15 + scrollHeight:"",
  16 + len:''
  17 + },
  18 +
  19 + /**
  20 + * 生命周期函数--监听页面加载
  21 + */
  22 + onLoad: function (options) {
  23 +
  24 + },
  25 +
  26 + //获取默认客户
  27 + getmorenkehu(){
  28 + console.log(7654321)
  29 + let that = this;
  30 + let url = 'user/getCustomerList';
  31 + let param = {
  32 + page: 1,
  33 + is_default: 1
  34 + }
  35 +
  36 + app.post(url, param, 'get').then((res) => {
  37 + console.log(res);
  38 +
  39 + this.setData({
  40 + morenkehu:res[0]
  41 + })
  42 +
  43 + console.log(res.length)
  44 +
  45 + if(res.length==0){
  46 + that.setData({
  47 + showmoren:false
  48 + })
  49 + }else{
  50 + that.setData({
  51 + showmoren:true
  52 + })
  53 + }
  54 +
  55 + }).catch((err) => {
  56 +
  57 +
  58 + })
  59 + },
  60 +
  61 + //获取客户列表
  62 + getkehulist(){
  63 + let that = this;
  64 + let url = 'user/getCustomerList';
  65 + let param={
  66 + page:this.data.page,
  67 + is_default:0
  68 + }
  69 +
  70 + app.post(url, param, 'get').then((res) => {
  71 + console.log(res);
  72 + this.setData({
  73 + kehulist:this.data.kehulist.concat(res)
  74 + })
  75 +
  76 +
  77 + let len = this.data.kehulist.length;
  78 + console.log(len)
  79 + len = len * 120+100;
  80 + this.setData({
  81 + len: len
  82 + })
  83 +
  84 + }).catch((err) => {
  85 +
  86 +
  87 + })
  88 + },
  89 +
  90 + //编辑客户
  91 + editkehu(e){
  92 + let id=e.currentTarget.dataset.id;
  93 + wx.navigateTo({
  94 + url: '/pages/addkehu/addkehu?editype='+1+'&id='+id,
  95 + })
  96 + },
  97 + //删除客户
  98 + delkehu(e){
  99 + console.log(e)
  100 + let that = this;
  101 + let id=e.currentTarget.dataset.id
  102 +
  103 + let url = 'user/delCustomer';
  104 + let param = {
  105 + customer_id: id,
  106 +
  107 + }
  108 +
  109 + app.post(url, param, 'get').then((res) => {
  110 + console.log(res);
  111 + wx.showToast({
  112 + title: '删除客户成功',
  113 + icon:"none"
  114 + })
  115 +
  116 +
  117 +
  118 + setTimeout(function(){
  119 + that.setData({
  120 + page: 1,
  121 + kehulist: []
  122 +
  123 + })
  124 + that.getkehulist();
  125 + that.getmorenkehu();
  126 + },1500)
  127 +
  128 +
  129 +
  130 + }).catch((err) => {
  131 +
  132 +
  133 + })
  134 +
  135 + },
  136 +
  137 + //选择默认地址
  138 + select(e){
  139 + let item = e.currentTarget.dataset.item;
  140 + console.log(item)
  141 +
  142 + let pages = getCurrentPages();
  143 +
  144 + // let currPage = pages[pages.length - 1]; //当前页面
  145 + let prevPage = pages[pages.length - 2]; //上一个页面
  146 +
  147 +
  148 +
  149 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
  150 + prevPage.setData({
  151 + morenaddress:item,
  152 + prepage:1
  153 + });
  154 +
  155 + wx.navigateBack({
  156 + checked:true
  157 + })
  158 +
  159 + },
  160 +
  161 +
  162 + //添加新客户
  163 + addkehu(){
  164 + wx.navigateTo({
  165 + url: '/pages/addkehu/addkehu',
  166 + })
  167 + },
  168 +
  169 +
  170 + letterTap(e) {
  171 + console.log(e)
  172 + const Item = e.currentTarget.dataset.item;
  173 + console.log('000888',Item)
  174 + // this.setData({
  175 + // cityListId: Item
  176 + // });
  177 +
  178 +
  179 +
  180 + // let scrollHeight = wx.getSystemInfoSync().windowHeight;
  181 + // this.setData({
  182 + // scrollHeight: scrollHeight
  183 + // })
  184 +
  185 + // var query = wx.createSelectorQuery();
  186 +
  187 + // var that = this;
  188 + // query.select('.city_left').boundingClientRect(function (rect) {
  189 + // console.log('66666',rect)
  190 +
  191 + // }).exec();
  192 +
  193 +
  194 + //滚动到某一位置
  195 + // var me = this;
  196 + // var query = wx.createSelectorQuery().in(me);
  197 + // query.selectViewport().scrollOffset()
  198 + // query.select("#comment").boundingClientRect();
  199 + // query.exec(function (res) {
  200 + // console.log(res);
  201 + // var miss = res[0].scrollTop + res[1].top - 10;
  202 + // wx.pageScrollTo({
  203 + // scrollTop: miss,
  204 + // duration: 300
  205 + // });
  206 +
  207 + // });
  208 +
  209 +
  210 + if (Item == '#') {
  211 + this.setData({
  212 + scrollHeight: this.data.len
  213 + });
  214 +
  215 +
  216 + } else {
  217 + this.setData({
  218 + cityListId: Item
  219 + });
  220 + }
  221 + console.log('909090', this.data.scrollHeight)
  222 +
  223 + console.log('77777', Item)
  224 +
  225 + console.log("..............." + this.data.cityListId);
  226 + },
  227 + /**
  228 + * 生命周期函数--监听页面初次渲染完成
  229 + */
  230 + onReady: function () {
  231 +
  232 + },
  233 +
  234 + /**
  235 + * 生命周期函数--监听页面显示
  236 + */
  237 + onShow: function () {
  238 + //获取默认客户
  239 + this.getmorenkehu();
  240 + this.setData({
  241 + kehulist:[],
  242 + page:1
  243 + })
  244 +
  245 + this.getkehulist();
  246 +
  247 + },
  248 +
  249 + /**
  250 + * 生命周期函数--监听页面隐藏
  251 + */
  252 + onHide: function () {
  253 +
  254 + },
  255 +
  256 + /**
  257 + * 生命周期函数--监听页面卸载
  258 + */
  259 + onUnload: function () {
  260 +
  261 + },
  262 +
  263 + /**
  264 + * 页面相关事件处理函数--监听用户下拉动作
  265 + */
  266 + onPullDownRefresh: function () {
  267 +
  268 + },
  269 +
  270 + /**
  271 + * 页面上拉触底事件的处理函数
  272 + */
  273 + onReachBottom: function () {
  274 + let newpage=this.data.page;
  275 + newpage++;
  276 + this.setData({
  277 + page:newpage
  278 + })
  279 +
  280 + this.getkehulist()
  281 +
  282 + },
  283 +
  284 + /**
  285 + * 用户点击右上角分享
  286 + */
  287 + onShareAppMessage: function () {
  288 +
  289 + }
  290 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class='mykehuhead'>
  2 + <view class="mykehuleft">我的客户</view>
  3 + <view class="addkehu" bindtap="addkehu">添加新客户</view>
  4 +</view>
  5 +
  6 +<view class="kehubox morenke" wx:if="{{showmoren}}">
  7 + <view class="kehuitem" bindtap="select" data-item="{{morenkehu}}">
  8 +
  9 + <view class="itemleftimg">
  10 + <image src="/img/address.png"></image>
  11 + </view>
  12 +
  13 + <view class="itemmiddle">
  14 + <view class="itemmiddletop">{{morenkehu.customer_name}} {{morenkehu.contact_name}}</view>
  15 + <view class="itemmiddlebottom">{{morenkehu.receive_name}} {{morenkehu.mobile}} </view>
  16 + <view class="itemmiddlebottom">{{morenkehu.address}}</view>
  17 +
  18 + </view>
  19 +
  20 + <view class="delimg">
  21 + <view class="itemright edigtupian" catchtap='editkehu' data-id="{{morenkehu.id}}">
  22 + <image src="/img/editaddress.png"></image>
  23 + </view>
  24 +
  25 + <view class="itemright" catchtap='delkehu' data-id="{{morenkehu.id}}">
  26 + <image src="/img/delshan.png"></image>
  27 + </view>
  28 + </view>
  29 + </view>
  30 +</view>
  31 +<!-- <view class="kehubox">
  32 + <view class="kehuitem" wx:for="{{kehulist}}" wx:key="" bindtap="select" data-item="{{item}}">
  33 + <view class="itemleftimg">
  34 + <image src="/img/address.png"></image>
  35 + </view>
  36 +
  37 + <view class="itemmiddle">
  38 + <view class="itemmiddletop">{{item.customer_name}} {{item.mobile}}</view>
  39 + <view class="itemmiddlebottom">{{item.region}} {{item.address}}</view>
  40 + </view>
  41 +
  42 + <view class="delimg">
  43 + <view class="itemright edigtupian" catchtap='editkehu' data-id="{{item.id}}">
  44 + <image src="/img/editaddress.png"></image>
  45 + </view>
  46 +
  47 + <view class="itemright" catchtap='delkehu' data-id="{{item.id}}">
  48 + <image src="/img/delshan.png"></image>
  49 + </view>
  50 + </view>
  51 +
  52 + </view>
  53 +
  54 +</view> -->
  55 +
  56 +
  57 +<view class='city_box'>
  58 + <view class='city_left'>
  59 + <scroll-view style='width:100%;height:100%;' scroll-with-animation scroll-into-view='{{cityListId}}' class="citybox" scroll-y='true' scroll-top="{{scrollHeight}}">
  60 + <!-- <view class="hot">
  61 + <view class="hotimg">
  62 + <image src="{{url}}bicon_08@2x.png"></image>
  63 + </view>
  64 +
  65 + <view class="hotzi">
  66 + <image src="{{url}}bicon_07@2x.png"></image>
  67 + </view>
  68 + </view> -->
  69 + <!-- <view class='new_city'>
  70 +
  71 + <view class='new_city_box'>
  72 + <view class='new_city_text' wx:for='{{newcity}}' wx:key='this' data-types='new' catchtap='cityTap' data-val='{{item}}'>
  73 + <view class="hotgood" bindtap="jumpbrand" data-id="{{item.id}}">
  74 + <view class="imgleft">
  75 + <image src="{{item.logo}}" mode='aspectFit'></image>
  76 + </view>
  77 + <view class="contentright">
  78 + <view class="contenttop">{{item.name}}</view>
  79 + <view class="contenbottom">
  80 + <text class="textname">{{item.sort_name}}</text>
  81 + <text class="textname">{{item.country}}</text>
  82 + <text class="textname">{{item.city}}</text>
  83 + <text class="textname">{{item.odor_name}}</text>
  84 + </view>
  85 + </view>
  86 +
  87 + </view>
  88 +
  89 + </view>
  90 + </view>
  91 + </view> -->
  92 +
  93 +
  94 +
  95 + <view class='city_list_box'>
  96 + <block wx:for='{{kehulist}}' wx:key='this' wx:for-item='letterItem' wx:for-index='letterIndex'>
  97 + <view class='city_first_letter' id='{{letterItem.acronym}}'>{{letterItem.acronym}}</view>
  98 + <!-- {{item.cityName}} -->
  99 + <view class='city_name' wx:for='{{letterItem.list}}' id='{{letterItem.acronym}}' wx:key='this' data-types='list' bindtap="jumpbrand" data-id="{{item.id}}" data-index='{{index}}' data-val='{{item}}'>
  100 +
  101 + <!-- <view class="imgleft">
  102 + <image src="{{item.logo}}" mode="aspectFit"></image>
  103 + </view> -->
  104 + <view class="contentright">
  105 + <view class="contenttop">{{item.acronym}}</view>
  106 +
  107 +
  108 +
  109 + <view class="kehuitem" bindtap="select" data-item="{{item}}">
  110 + <view class="itemleftimg">
  111 + <image src="/img/address.png"></image>
  112 + </view>
  113 +
  114 + <view class="itemmiddle">
  115 + <view class="itemmiddletop">{{item.customer_name}} {{item.contact_name}}</view>
  116 + <view class="itemmiddlebottom">{{item.receive_name}} {{item.mobile}}</view>
  117 + <view class="itemmiddlebottom">{{item.address}}</view>
  118 + </view>
  119 +
  120 + <view class="delimg">
  121 + <view class="itemright edigtupian" catchtap='editkehu' data-id="{{item.id}}">
  122 + <image src="/img/editaddress.png"></image>
  123 + </view>
  124 +
  125 + <view class="itemright" catchtap='delkehu' data-id="{{item.id}}">
  126 + <image src="/img/delshan.png"></image>
  127 + </view>
  128 + </view>
  129 +
  130 + </view>
  131 + </view>
  132 +
  133 + </view>
  134 + </block>
  135 + </view>
  136 + </scroll-view>
  137 + </view>
  138 + <view class='city_right'>
  139 + <text class='letter_item' wx:for='{{letter}}' wx:key='this' catchtap='letterTap' data-item='{{item}}'>{{item}}</text>
  140 + </view>
  141 +</view>
  1 +page{
  2 + background: #F5F5FA;
  3 + height:100%;
  4 +}
  5 +.kehubox{
  6 + width:702rpx;
  7 + margin:20rpx auto 0;
  8 + background: #fff;
  9 + border-radius: 28rpx;
  10 + padding: 0rpx 29rpx;
  11 + box-sizing: border-box;
  12 + margin-bottom:50rpx;
  13 +}
  14 +.mykehuhead{
  15 + display:flex;
  16 + align-items: center;
  17 + justify-content: space-between;
  18 + padding: 34rpx 23rpx 20rpx 23rpx;
  19 + box-sizing: border-box;
  20 +}
  21 +.mykehuleft{
  22 + color:#141414;
  23 + font-size: 40rpx;
  24 + font-weight: bold;
  25 +}
  26 +.addkehu{
  27 + color:#2781FB;
  28 + font-size: 28rpx;
  29 +}
  30 +.kehuitem{
  31 + display:flex;
  32 + align-items: center;
  33 + justify-content: space-between;
  34 + padding: 36rpx 0;
  35 + box-sizing: border-box;
  36 + border-bottom:1rpx solid #f5f5f5;
  37 +}
  38 +.itemleftimg{
  39 + width:35rpx;
  40 + height:34rpx;
  41 + font-size:0;
  42 +}
  43 +.itemright{
  44 + width:28rpx;
  45 + height:27rpx;
  46 + font-size: 0
  47 +}
  48 +.itemmiddle{
  49 + width:439rpx;
  50 + border-right:1rpx solid #f5f5f5;
  51 + padding-right: 68rpx;
  52 + box-sizing: border-box
  53 +}
  54 +.itemmiddletop{
  55 + color:#141414;
  56 + font-size: 28rpx;
  57 +}
  58 +.itemmiddlebottom{
  59 + width:410rpx;
  60 + overflow: hidden;
  61 + text-overflow: ellipsis;
  62 + white-space: nowrap;
  63 + color:#141414;
  64 + font-size: 28rpx;
  65 + margin-top:20rpx;
  66 +}
  67 +.morenke{
  68 + margin-bottom:30rpx
  69 +}
  70 +.delimg{
  71 + display:flex;
  72 + align-items: center
  73 +}
  74 +.edigtupian{
  75 + margin-right:40rpx;
  76 +}
  77 +
  78 +
  79 +.city_box{
  80 + height:100%;
  81 + background: #fff;
  82 + display: flex;
  83 +}
  84 +.city_left{
  85 + flex: 1;
  86 +}
  87 +.city_right{
  88 + width: 60rpx;
  89 + display: flex;
  90 + flex-direction: column;
  91 + justify-content: space-around;
  92 +}
  93 +.letter_item{
  94 + flex: 1;
  95 + display: block;
  96 + font-size: 24rpx;
  97 + color: #33B9FF;
  98 + text-align: center;
  99 +}
  100 +.city_locate,.national{
  101 + height: 80rpx;
  102 + line-height: 80rpx;
  103 + border-bottom: 1px solid #efefef;
  104 + font-size: 28rpx;
  105 + color: #333;
  106 + padding-left: 25rpx;
  107 +}
  108 +.city_locate_title{
  109 + color: #999;
  110 + margin-right: 20rpx;
  111 +}
  112 +.new_city{
  113 + background: #efefef;
  114 + font-size: 28rpx;
  115 +}
  116 +.new_city_title{
  117 + line-height: 50rpx;
  118 + color: #999;
  119 + padding-left: 25rpx;
  120 + margin-bottom: 20rpx;
  121 +}
  122 +.new_city_box{
  123 + display: flex;
  124 + flex-wrap: wrap;
  125 +}
  126 +.new_city_text{
  127 + width: 200rpx;
  128 + text-align: center;
  129 + line-height: 70rpx;
  130 + background: #fff;
  131 + border-radius: 35rpx;
  132 + margin:0 0 22rpx 22rpx;
  133 +}
  134 +.city_first_letter{
  135 + line-height: 40rpx;
  136 + height: 40rpx;
  137 + padding-left: 25rpx;
  138 + font-size: 28rpx;
  139 + background: #eee;
  140 + color: #999;
  141 +}
  142 +.city_name{
  143 + display: block;
  144 + /* line-height: 80rpx;
  145 + height: 80rpx; */
  146 + border-bottom: 1px solid #efefef;
  147 + font-size: 28rpx;
  148 + color: #333;
  149 + padding-left: 25rpx;
  150 +}
  1 +// pages/myorder/myorder.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + page:1,
  10 + orderlist:[]
  11 + },
  12 +
  13 + /**
  14 + * 生命周期函数--监听页面加载
  15 + */
  16 + onLoad: function (options) {
  17 + this.germyorder()
  18 + },
  19 +
  20 + //获取我的订单
  21 + germyorder(){
  22 + let that=this;
  23 + let url = 'user/getMyOrderList';
  24 + let param={
  25 + page:this.data.page
  26 + }
  27 +
  28 + app.post(url, param, 'get').then((res) => {
  29 + console.log(res);
  30 +
  31 + for(var obj of res){
  32 + obj.total_price = obj.total_price.toFixed("2")
  33 + }
  34 + that.setData({
  35 + orderlist:that.data.orderlist.concat(res)
  36 + })
  37 +
  38 + }).catch((err) => {
  39 +
  40 + })
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面初次渲染完成
  45 + */
  46 + onReady: function () {
  47 +
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面显示
  52 + */
  53 + onShow: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 生命周期函数--监听页面隐藏
  59 + */
  60 + onHide: function () {
  61 +
  62 + },
  63 +
  64 + /**
  65 + * 生命周期函数--监听页面卸载
  66 + */
  67 + onUnload: function () {
  68 +
  69 + },
  70 +
  71 + /**
  72 + * 页面相关事件处理函数--监听用户下拉动作
  73 + */
  74 + onPullDownRefresh: function () {
  75 +
  76 + },
  77 +
  78 + /**
  79 + * 页面上拉触底事件的处理函数
  80 + */
  81 + onReachBottom: function () {
  82 + let newpage=this.data.page;
  83 + newpage++;
  84 + this.setData({
  85 + page:newpage
  86 + })
  87 +
  88 + this.germyorder()
  89 + },
  90 +
  91 + /**
  92 + * 用户点击右上角分享
  93 + */
  94 + onShareAppMessage: function () {
  95 +
  96 + }
  97 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="myordername">
  2 + 我的订单
  3 +</view>
  4 +<view class="cartkong" wx:if="{{orderlist.length==0}}">
  5 + <view class="cartkongimg">
  6 + <image src="/img/cartimg.png"></image>
  7 + </view>
  8 +
  9 + <view class="konggou">暂无数据</view>
  10 +</view>
  11 +
  12 +
  13 +<view class="orderbox" wx:else>
  14 + <view class="orderitem" wx:for="{{orderlist}}" wx:key="">
  15 + <view class="orderitemhead">
  16 + <view class="orderitemleft">
  17 + <view class="lianxiname">
  18 + <view class="kehuname">{{item.customer_name}}</view>
  19 + <view class="kehunameo">{{item.mobile}}</view>
  20 +
  21 + <view class="orderitemright">{{item.createtime}}</view>
  22 + </view>
  23 +
  24 +
  25 +
  26 + <view class="lanxianren">联系人:
  27 + <text wx:if="{{item.contact_name!=''}}">{{item.contact_name}}</text>
  28 + <text wx:else>暂无</text> </view>
  29 + <view class="shouhuoren">收货人:
  30 + <text wx:if="{{item.receive_name!=''}}">{{item.receive_name}}</text>
  31 + <text wx:else>暂无</text>
  32 + </view>
  33 +
  34 + <view class="lanxianren">订单流水号:{{item.order_sn}}</view>
  35 + </view>
  36 +
  37 +
  38 + </view>
  39 +
  40 + <view class="orderbox">
  41 + <view class="orderboxitem" wx:for="{{item.order}}" wx:key="">
  42 +
  43 +
  44 + <view class="ordercontent">
  45 + <view class="contentname">{{item.number}}</view>
  46 + <view class="contentnum">{{item.name}}</view>
  47 + </view>
  48 + <view class="orderitemnum">x{{item.amount}}</view>
  49 +
  50 + <view class="beizhu">备注:
  51 + <text wx:if="{{item.mark!=''}}">{{item.mark}}</text>
  52 + <text wx:else>暂无备注</text>
  53 + </view>
  54 +
  55 + </view>
  56 + </view>
  57 +
  58 + <view class="ordermoney">
  59 + <view class="ordermoneyleft">总金额</view>
  60 + <view class="ordermoneyright">¥{{item.total_price}}</view>
  61 + </view>
  62 + </view>
  63 +
  64 +</view>
  1 +page {
  2 + padding: 0 23rpx;
  3 + box-sizing: border-box;
  4 + background: #f5f5fa;
  5 +}
  6 +
  7 +.myordername {
  8 + color: #141414;
  9 + font-size: 38rpx;
  10 + padding: 34rpx 0 0rpx;
  11 + box-sizing: border-box;
  12 + font-weight: bold;
  13 +}
  14 +.orderbox{
  15 + padding-bottom: 20rpx;
  16 +}
  17 +
  18 +.orderitem {
  19 + width: 702rpx;
  20 + background: #fff;
  21 + padding: 27rpx 40rpx;
  22 + box-sizing: border-box;
  23 + border-radius: 28rpx;
  24 + margin-top:27rpx;
  25 +}
  26 +
  27 +.orderitemhead {
  28 + display: flex;
  29 + align-items: center;
  30 + justify-content: space-between;
  31 +}
  32 +
  33 +.kehuname {
  34 + width:258rpx;
  35 + overflow: hidden;
  36 + text-overflow: ellipsis;
  37 + white-space: nowrap;
  38 + color: #141414;
  39 + font-size: 32rpx;
  40 +}
  41 +
  42 +.kehunameo {
  43 + color: #9e9e9e;
  44 + font-size: 28rpx;
  45 + margin-left: 17rpx;
  46 +}
  47 +
  48 +.orderitemright {
  49 + color: #9e9e9e;
  50 + font-size: 28rpx;
  51 + margin-left:20rpx;
  52 +}
  53 +
  54 +.ordercontent {
  55 + display: flex;
  56 + align-items: center;
  57 + margin-top: 10rpx;
  58 +}
  59 +
  60 +.contentname {
  61 + color: #9e9e9e;
  62 + font-size: 24rpx;
  63 +}
  64 +
  65 +.contentnum {
  66 + color: #9e9e9e;
  67 + font-size: 24rpx;
  68 + margin-left: 17rpx;
  69 +}
  70 +
  71 +.orderitemnum {
  72 + color: #9e9e9e;
  73 + font-size: 24rpx;
  74 + margin-top: 5rpx;
  75 +}
  76 +
  77 +.ordermoney {
  78 + display: flex;
  79 + align-items: center;
  80 + justify-content: flex-end;
  81 +}
  82 +
  83 +.ordermoneyleft {
  84 + color: #141414;
  85 + font-size: 32rpx;
  86 + margin-right: 31rpx;
  87 +}
  88 +.ordermoneyright{
  89 + color:#2781FB;
  90 + font-size: 32rpx;
  91 + margin-right:15rpx;
  92 +}
  93 +.lianxiname{
  94 + display:flex;
  95 + align-items: center
  96 +}
  97 +.lanxianren{
  98 + color:#9E9E9E;
  99 + font-size: 28rpx;
  100 + margin-top:10rpx;
  101 +}
  102 +.shouhuoren{
  103 + color:#9E9E9E;
  104 + font-size: 28rpx;
  105 + margin-top:10rpx;
  106 +}
  107 +.beizhu{
  108 + color:#9E9E9E;
  109 + font-size: 24rpx;
  110 +
  111 +}
  1 +// pages/orderdetail/orderdetail.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + totalmoney: 0,
  10 + orderlist: [],
  11 + morenaddress: '',
  12 + customer_id: '',
  13 + order_id: [],
  14 + amount: [],
  15 + prepage:'',
  16 + que:1
  17 + },
  18 +
  19 + /**
  20 + * 生命周期函数--监听页面加载
  21 + */
  22 + onLoad: function(options) {
  23 +
  24 + },
  25 +
  26 + //获取订单列表
  27 + getorderlist() {
  28 + let that = this;
  29 + let url = 'index/getOrderList';
  30 +
  31 + app.post(url, '', 'get').then((res) => {
  32 + console.log(res);
  33 +
  34 + that.setData({
  35 + orderlist: res.data,
  36 + totalmoney: res.total_price.toFixed("2")
  37 + })
  38 +
  39 + let neworderlist = that.data.orderlist;
  40 + let orderid = [];
  41 + let goodnum = [];
  42 +
  43 + for (var obj of neworderlist) {
  44 + orderid.push(obj.id);
  45 + goodnum.push(obj.amount)
  46 + }
  47 +
  48 + that.setData({
  49 + order_id: orderid,
  50 + amount: goodnum
  51 + })
  52 +
  53 + }).catch((err) => {
  54 +
  55 +
  56 + })
  57 + },
  58 +
  59 + //进入客户列表页面
  60 + gokehu(){
  61 + wx.navigateTo({
  62 + url: '/pages/mykehu/mykehu',
  63 + })
  64 + },
  65 +
  66 + //获取默认地址
  67 + getmorenaddress() {
  68 + let that = this;
  69 + let url = 'user/getCustomerList';
  70 + let param = {
  71 + page: 1,
  72 + is_default: 1
  73 + }
  74 +
  75 + app.post(url, param, 'get').then((res) => {
  76 + console.log(res);
  77 +
  78 + that.setData({
  79 + morenaddress: res[0],
  80 + customer_id: res[0].id
  81 + })
  82 +
  83 +
  84 +
  85 + }).catch((err) => {
  86 +
  87 +
  88 + })
  89 + },
  90 +
  91 + //输入折扣率
  92 + enterzhekou(e) {
  93 + if (e.detail.value > 1) {
  94 + wx.showToast({
  95 + title: '请输入0-1之间的数字',
  96 + icon: 'none'
  97 + })
  98 +
  99 +
  100 + } else {
  101 + let totalqian=0;
  102 + let id = e.currentTarget.dataset.id;
  103 + let neworderlist = this.data.orderlist;
  104 + for (var obj of neworderlist) {
  105 + if (obj.goods_id == id) {
  106 + obj.discount = e.detail.value;
  107 + //let dis_price = Number(obj.price) *Number(obj.amount)* Number(e.detail.value);
  108 + let dis_price = Number(obj.price)*Number(e.detail.value);
  109 + obj.dis_price = dis_price.toFixed("2");
  110 + }
  111 + totalqian = totalqian + Number(obj.dis_price)*Number(obj.amount);
  112 + }
  113 +
  114 +
  115 + totalqian = totalqian.toFixed("2")
  116 +
  117 + this.setData({
  118 + orderlist: neworderlist,
  119 + totalmoney: totalqian
  120 + })
  121 +
  122 + wx.setStorageSync("orderarr", neworderlist)
  123 + }
  124 +
  125 + },
  126 +
  127 + //输入折扣价格
  128 + enterzhekouprice(e) {
  129 + let id = e.currentTarget.dataset.id;
  130 + let neworderlist = this.data.orderlist;
  131 + let totalqian = 0;
  132 + for (var obj of neworderlist) {
  133 + if (obj.goods_id == id) {
  134 + obj.dis_price = e.detail.value;
  135 + let zhekou=Number(e.detail.value)/Number(obj.price);
  136 + zhekou=zhekou.toFixed("2");
  137 + obj.discount=zhekou;
  138 + }
  139 +
  140 + totalqian = totalqian + Number(obj.dis_price)*Number(obj.amount);
  141 + }
  142 +
  143 + this.setData({
  144 + orderlist: neworderlist,
  145 + totalmoney: totalqian
  146 + })
  147 +
  148 + wx.setStorageSync("orderarr", neworderlist)
  149 +
  150 + console.log(this.data.orderlist)
  151 + },
  152 + //输入开发票名称
  153 + enterfaname(e) {
  154 + let id = e.currentTarget.dataset.id;
  155 + let neworderlist = this.data.orderlist;
  156 + for (var obj of neworderlist) {
  157 + if (obj.goods_id== id) {
  158 + obj.invoice_name = e.detail.value
  159 + }
  160 + }
  161 +
  162 + this.setData({
  163 + orderlist: neworderlist
  164 + })
  165 + wx.setStorageSync("orderarr", neworderlist)
  166 + },
  167 +
  168 + //输入备注
  169 + entermark(e) {
  170 + let id = e.currentTarget.dataset.id;
  171 + let neworderlist = this.data.orderlist;
  172 + for (var obj of neworderlist) {
  173 + if (obj.goods_id == id) {
  174 + obj.mark = e.detail.value
  175 + }
  176 + }
  177 +
  178 + this.setData({
  179 + orderlist: neworderlist
  180 + })
  181 + wx.setStorageSync("orderarr", neworderlist)
  182 + },
  183 +
  184 + //确定提交订单
  185 + quedingti() {
  186 + let that=this;
  187 +
  188 + console.log(that.data.customer_id)
  189 +
  190 + if (that.data.customer_id==''){
  191 + wx.showToast({
  192 + title: '请选择地址',
  193 + icon:'none'
  194 + })
  195 +
  196 + return false
  197 + }
  198 + let neworderlist = this.data.orderlist;
  199 + for (var obj of neworderlist) {
  200 + if (obj.discount == '') {
  201 + wx.showToast({
  202 + title: '请把折扣率填写完整',
  203 + icon: 'none'
  204 + })
  205 +
  206 + return false
  207 + } else if (obj.dis_price == '') {
  208 + wx.showToast({
  209 + title: '请把折扣率填写完整',
  210 + icon: 'none'
  211 + })
  212 +
  213 + return false
  214 + } else if (obj.invoice_name==''){
  215 + wx.showToast({
  216 + title: '请把开发票品名填写完整',
  217 + icon: 'none'
  218 + })
  219 + return false
  220 +
  221 + }
  222 +
  223 +
  224 +
  225 +
  226 +
  227 +
  228 +
  229 + }
  230 +
  231 + that.setData({
  232 + que:""
  233 + })
  234 +
  235 +
  236 + let newdiscount = [];
  237 + let newdis_price = [];
  238 + let newinvoice_name = [];
  239 + let newmark = [];
  240 + for (var obj of neworderlist) {
  241 + console.log(obj.mark)
  242 + newdiscount.push(obj.discount);
  243 + newdis_price.push(obj.dis_price);
  244 + newinvoice_name.push(obj.invoice_name);
  245 + newmark.push(obj.mark)
  246 + }
  247 +
  248 + if (newmark.length==0){
  249 + newmark=''
  250 + }else{
  251 + for(var i=0;i<newmark.length;i++){
  252 + if (newmark[i]==''){
  253 + newmark[i]=0
  254 + }
  255 + }
  256 + }
  257 +
  258 + console.log(newmark)
  259 +
  260 +
  261 +
  262 + let url = 'index/confirmOrder';
  263 + let param = {
  264 + customer_id: that.data.customer_id,
  265 + goods_id: that.data.order_id.join(","),
  266 + amount: that.data.amount.join(","),
  267 + discount: newdiscount.join(","),
  268 + dis_price: newdis_price.join(","),
  269 + invoice_name: newinvoice_name.join(","),
  270 + mark: newmark.join(",")
  271 +
  272 + }
  273 +
  274 + console.log(param)
  275 +
  276 + app.post(url, param, 'post').then((res) => {
  277 + console.log(res);
  278 +
  279 + // wx.showToast({
  280 + // title: '提交成功',
  281 + // icon: "none"
  282 + // })
  283 + wx.setStorageSync('orderarr', '');
  284 + wx.setStorageSync('total_price', '');
  285 +
  286 + // wx.clearStorage("orderarr");
  287 + // wx.clearStorage("total_price");
  288 + that.clearcart()
  289 +
  290 +
  291 + setTimeout(function(){
  292 + wx.navigateTo({
  293 + url: '/pages/myorder/myorder',
  294 + })
  295 + },200)
  296 +
  297 + }).catch((err) => {
  298 +
  299 + console.log(err)
  300 + })
  301 +
  302 +
  303 + },
  304 +
  305 + //提交订单清除购物车
  306 + clearcart() {
  307 + let that = this;
  308 + let newcartidarr = this.data.order_id;
  309 +
  310 + let url = 'index/delCar';
  311 + let param = {
  312 + goods_id: newcartidarr.join(","),
  313 +
  314 + }
  315 +
  316 + app.post(url, param, 'get').then((res) => {
  317 + console.log(res);
  318 +
  319 + }).catch((err) => {
  320 +
  321 + })
  322 + },
  323 +
  324 +
  325 + /**
  326 + * 生命周期函数--监听页面初次渲染完成
  327 + */
  328 + onReady: function() {
  329 +
  330 + },
  331 +
  332 + /**
  333 + * 生命周期函数--监听页面显示
  334 + */
  335 + onShow: function() {
  336 + let that=this;
  337 +
  338 + let xinorderlist=wx.getStorageSync("orderlist");
  339 + console.log('000888', xinorderlist)
  340 + // if (xinorderlist!=''){
  341 + // this.setData({
  342 + // orderlist:xinorderlist
  343 + // })
  344 + // }
  345 +
  346 + let neworderlist = wx.getStorageSync("orderarr");
  347 + let newtotal_price = wx.getStorageSync("total_price")
  348 + console.log(neworderlist)
  349 + let orderid = [];
  350 + let goodnum = [];
  351 +
  352 + for (var obj of neworderlist) {
  353 + console.log('00099978', typeof(obj.dis_price));
  354 + obj.dis_price = Number(obj.dis_price)
  355 + obj.dis_price=obj.dis_price.toFixed("2")
  356 + orderid.push(obj.goods_id);
  357 + goodnum.push(obj.amount)
  358 + }
  359 +
  360 + that.setData({
  361 + orderlist:neworderlist,
  362 + totalmoney: newtotal_price,
  363 + order_id: orderid,
  364 + amount: goodnum
  365 + })
  366 +
  367 + let pages = getCurrentPages();
  368 +
  369 + let currPage = pages[pages.length - 1]; //当前页面
  370 +
  371 + if (currPage.data.prepage==1){
  372 + this.setData({
  373 + morenaddress: currPage.data.morenaddress,
  374 + customer_id: currPage.data.morenaddress.id
  375 + })
  376 + }else{
  377 + this.getmorenaddress();
  378 + }
  379 +
  380 +
  381 + },
  382 +
  383 + /**
  384 + * 生命周期函数--监听页面隐藏
  385 + */
  386 + onHide: function() {
  387 +
  388 + },
  389 +
  390 + /**
  391 + * 生命周期函数--监听页面卸载
  392 + */
  393 + onUnload: function() {
  394 +
  395 + },
  396 +
  397 + /**
  398 + * 页面相关事件处理函数--监听用户下拉动作
  399 + */
  400 + onPullDownRefresh: function() {
  401 +
  402 + },
  403 +
  404 + /**
  405 + * 页面上拉触底事件的处理函数
  406 + */
  407 + onReachBottom: function() {
  408 +
  409 + },
  410 +
  411 + /**
  412 + * 用户点击右上角分享
  413 + */
  414 + onShareAppMessage: function() {
  415 +
  416 + }
  417 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class='detailhead' bindtap='gokehu'>
  2 + <view class="detailzuo">
  3 + <view class="detailheadleft">
  4 + <image src="/img/address.png"></image>
  5 + </view>
  6 + <view class="detailmiddle">
  7 + <view class="detailtop">
  8 + <text class="xingming">{{morenaddress.customer_name}}</text>
  9 + <text class="xingmingnum">{{morenaddress.contact_name}}</text>
  10 + </view>
  11 + <view class="detailaddress">{{morenaddress.receive_name}} {{morenaddress.mobile}}</view>
  12 + </view>
  13 + </view>
  14 + <view class="detailright">
  15 + <image src="/img/jiantou2.png"></image>
  16 + </view>
  17 +
  18 +</view>
  19 +
  20 +<view class="wuliaobox">
  21 + <view class="detailbox" wx:for="{{orderlist}}" wx:key="">
  22 +
  23 + <view class="detailboxname wuliaobian">
  24 + {{item.number}}
  25 + </view>
  26 +
  27 + <view class="goodname wuliaobian">{{item.name}}</view>
  28 +
  29 + <view class="goodshu wuliaobian">
  30 + <view class="goodshuleft">¥{{item.price}}</view>
  31 + <view class="goodshuright">x{{item.amount}}</view>
  32 + </view>
  33 + <view class="shuruzhekou wuliaobian">
  34 + <view class="enterzhe">输入折扣率</view>
  35 + <view class="enterzhenum">
  36 + <input placeholder='请输入折扣率' bindinput="enterzhekou" value="{{item.discount}}" data-id="{{item.goods_id}}"/>
  37 + </view>
  38 + </view>
  39 +
  40 + <view class="jaige wuliaobian">
  41 + <view class="jaigeleft">¥</view>
  42 + <view class="jaigeright">
  43 + <input placeholder='请输入折扣价格' value="{{item.dis_price}}" type="number" bindinput="enterzhekouprice" data-id="{{item.goods_id}}"/>
  44 + </view>
  45 + </view>
  46 +
  47 + <view class="jaige wuliaobian">
  48 + <view class="jaigeleft">开发票品名</view>
  49 + <view class="jaigeright">
  50 + <input placeholder='请输入开发票品名' value="{{item.invoice_name}}" bindinput="enterfaname" data-id="{{item.goods_id}}"/>
  51 + </view>
  52 + </view>
  53 +
  54 + <view class="jaige beizhu">
  55 + <view class="jaigeleft">自由文本:</view>
  56 + <view class="jaigeright">
  57 + <input placeholder='Abcam产品请输入规格' value="{{item.mark}}" bindinput="entermark" data-id="{{item.goods_id}}"/>
  58 + </view>
  59 + </view>
  60 +
  61 + </view>
  62 +</view>
  63 +<view class="footbox">
  64 + <view class="footboxhead">
  65 + 总金额:¥{{totalmoney}}
  66 + </view>
  67 + <view class="quding" bindtap="quedingti" wx:if="{{que==1}}">确定</view>
  68 + <view class="quding" wx:else>确定</view>
  69 +</view>
  1 +page{
  2 + background: #F5F5FA;
  3 +}
  4 +.detailhead{
  5 + display:flex;
  6 + align-items: center;
  7 + justify-content: space-between;
  8 + width:702rpx;
  9 + height:141rpx;
  10 + background: #fff;
  11 + border-radius: 28rpx;
  12 + margin:34rpx auto 0;
  13 + padding: 0 29rpx;
  14 + box-sizing: border-box
  15 +
  16 +
  17 +}
  18 +.detailheadleft{
  19 + width:28rpx;
  20 + height:32rpx;
  21 + font-size: 0;
  22 + flex:0 0 auto;
  23 +}
  24 +.detailaddress{
  25 + color:#141414;
  26 + font-size: 28rpx;
  27 + margin-top:16rpx;
  28 +}
  29 +.detailmiddle{
  30 + margin-left:30rpx;
  31 +}
  32 +.detailtop{
  33 + color:#141414;
  34 + font-size: 28rpx;
  35 +}
  36 +.xingmingnum{
  37 + margin-left:61rpx;
  38 +}
  39 +.detailright{
  40 + width:30rpx;
  41 + height:46rpx;
  42 + font-size: 0
  43 +}
  44 +.detailzuo{
  45 + display:flex;
  46 + align-items: center
  47 +}
  48 +.wuliaobox{
  49 + padding-bottom: 180rpx;
  50 +}
  51 +.detailbox{
  52 + width:702rpx;
  53 + background: #fff;
  54 + border-radius: 28rpx;
  55 + margin:27rpx auto 0;
  56 + padding: 31rpx 29rpx;
  57 + box-sizing: border-box
  58 +}
  59 +.goodshu{
  60 + display:flex;
  61 + align-items: center;
  62 + justify-content: space-between
  63 +}
  64 +.shuruzhekou{
  65 + display:flex;
  66 + align-items: center
  67 +}
  68 +.enterzhe{
  69 + color:#141414;
  70 + font-size: 28rpx;
  71 +}
  72 +.enterzhenum{
  73 + color:#9E9E9E;
  74 + font-size: 26rpx;
  75 + margin-left: 40rpx;
  76 +}
  77 +.jaige{
  78 + display:flex;
  79 + align-items: center
  80 +}
  81 +.jaigeright{
  82 + margin-left:30rpx;
  83 +}
  84 +.jaigeright{
  85 + color:#9E9E9E;
  86 + font-size: 26rpx;
  87 +}
  88 +.jaigeleft{
  89 + color:#141414;
  90 + font-size: 26rpx;
  91 +}
  92 +.wuliaobian{
  93 + padding: 10rpx 0;
  94 + border-bottom:1rpx solid #f5f5f5;
  95 +}
  96 +.detailboxname,.goodname,.goodshu{
  97 + color:#141414;
  98 + font-size: 28rpx;
  99 +}
  100 +.enterbeizhu{
  101 + height:100rpx;
  102 +}
  103 +.enterbeizhu textarea{
  104 + height:100rpx;
  105 +}
  106 +
  107 +.footbox{
  108 + position: fixed;
  109 + bottom:0;
  110 + z-index: 99
  111 +}
  112 +.footboxhead{
  113 + width:750rpx;
  114 + display:flex;
  115 + align-items: center;
  116 + justify-content: flex-end;
  117 + background: #E9E9E9;
  118 + height:88rpx;
  119 + padding: 0 32rpx;
  120 + box-sizing: border-box;
  121 + color:#141414;
  122 + font-size: 28rpx;
  123 +}
  124 +.quding{
  125 + width:750rpx;
  126 + height:88rpx;
  127 + background: #2781FB;
  128 + color:#fff;
  129 + font-size: 30rpx;
  130 + text-align: center;
  131 + line-height: 88rpx;
  132 +}
  1 +// pages/seemore/seemore.js
  2 +const app=getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + morelist:[],
  10 + page:1
  11 + },
  12 +
  13 + /**
  14 + * 生命周期函数--监听页面加载
  15 + */
  16 + onLoad: function (options) {
  17 +
  18 + },
  19 +
  20 + getmorelist(){
  21 + let url = 'index/getMoreNoticeList';
  22 + let param={
  23 + page:this.data.page
  24 + }
  25 + app.post(url, param, 'get').then((res) => {
  26 + console.log(res);
  27 + this.setData({
  28 + morelist:this.data.morelist.concat(res)
  29 + })
  30 +
  31 + }).catch((err) => {
  32 +
  33 + })
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面初次渲染完成
  38 + */
  39 + onReady: function () {
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面显示
  45 + */
  46 + onShow: function () {
  47 + this.getmorelist()
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面隐藏
  52 + */
  53 + onHide: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 生命周期函数--监听页面卸载
  59 + */
  60 + onUnload: function () {
  61 +
  62 + },
  63 +
  64 + /**
  65 + * 页面相关事件处理函数--监听用户下拉动作
  66 + */
  67 + onPullDownRefresh: function () {
  68 +
  69 + },
  70 +
  71 + /**
  72 + * 页面上拉触底事件的处理函数
  73 + */
  74 + onReachBottom: function () {
  75 + let newpage=this.data.page;
  76 + newpage++;
  77 + this.setData({
  78 + page:newpage
  79 + })
  80 +
  81 + this.getmorelist()
  82 + },
  83 +
  84 + /**
  85 + * 用户点击右上角分享
  86 + */
  87 + onShareAppMessage: function () {
  88 +
  89 + }
  90 +})
  1 +{
  2 + "usingComponents": {}
  3 +}
  1 +<view class="souhead">
  2 + <image src='/img/bg_img.png'></image>
  3 +
  4 +</view>
  5 +
  6 +<view class="morebox">
  7 + <view class="titlebox" wx:for="{{morelist}}" wx:key="">
  8 + <view class="lancolor"></view>
  9 + <view class="gonggaobiao">
  10 + {{item.title}}
  11 +
  12 + <text class="riqidate">{{item.createtime}}</text>
  13 +
  14 + </view>
  15 + <view class="gonggaocontent">
  16 + {{item.introduce}}
  17 + </view>
  18 + </view>
  19 +
  20 +
  21 +
  22 +</view>
  1 +page {
  2 + background: #f5f5fa;
  3 + /* background: url('http://xkeasy.w.bronet.cn/static/images/background.png') no-repeat center; */
  4 +
  5 +}
  6 +
  7 +.souhead {
  8 + width: 750rpx;
  9 + height: 443rpx;
  10 + font-size: 0;
  11 + position: fixed;
  12 + top:0
  13 +}
  14 +
  15 +.souhead image {
  16 + width: 100%;
  17 + height: 100%;
  18 +}
  19 +
  20 +.swiper_image {
  21 + width: 701rpx;
  22 + height: 368rpx;
  23 + background: #fff;
  24 + border-radius: 28rpx;
  25 + position: absolute;
  26 + top: 62rpx;
  27 + left: 25rpx;
  28 + padding: 26rpx 13rpx;
  29 + box-sizing: border-box;
  30 +}
  31 +
  32 +/* .swiper_image swiper {
  33 + width: 701rpx;
  34 + height: 368rpx;
  35 + background: #fff;
  36 + border-radius: 28rpx;
  37 + position: absolute;
  38 + top: 62rpx;
  39 + left: 25rpx;
  40 + padding: 26rpx 13rpx;
  41 + box-sizing: border-box;
  42 +} */
  43 +
  44 +.morebox{
  45 + position: absolute;
  46 + top: 62rpx;
  47 + left: 25rpx;
  48 + padding-bottom: 20rpx;
  49 + z-index:999
  50 +}
  51 +
  52 +.titlebox {
  53 + width: 701rpx;
  54 + height: 368rpx;
  55 + background: #fff;
  56 + border-radius: 28rpx;
  57 +
  58 + padding: 26rpx 13rpx;
  59 + box-sizing: border-box;
  60 + margin-top:25rpx;
  61 +}
  62 +
  63 +.dots {
  64 + /* width: 156rpx; */
  65 + height: 36rpx;
  66 + display: flex;
  67 + flex-direction: row;
  68 + position: absolute;
  69 + justify-content: center;
  70 + left: 0;
  71 + right: 0;
  72 + bottom: 6rpx;
  73 +}
  74 +
  75 +/*未选中时的小圆点样式 */
  76 +
  77 +.dot {
  78 + width: 16rpx;
  79 + height: 16rpx;
  80 + border-radius: 50%;
  81 + margin-right: 26rpx;
  82 + background-color: #b9c0f7;
  83 +}
  84 +
  85 +/*选中以后的小圆点样式 */
  86 +
  87 +.active {
  88 + width: 16rpx;
  89 + height: 16rpx;
  90 + border-radius: 50%;
  91 + background-color: #2681fb;
  92 +}
  93 +
  94 +.lancolor {
  95 + width: 26rpx;
  96 + height: 26rpx;
  97 + border-radius: 50%;
  98 + background: #30a8ff;
  99 +}
  100 +
  101 +.gonggaobiao {
  102 + color: #000;
  103 + font-size: 32rpx;
  104 + text-align: center;
  105 + font-weight: bold;
  106 +}
  107 +
  108 +.gonggaocontent {
  109 + width: 611rpx;
  110 + margin: 42rpx auto 0;
  111 + height: 145rpx;
  112 + overflow-y: scroll;
  113 + color: #000;
  114 + font-size: 26rpx;
  115 +}
  116 +
  117 +.seemore {
  118 + color: #2681fb;
  119 + font-size: 26rpx;
  120 + display: flex;
  121 + justify-content: flex-end;
  122 + /* margin-top: 25rpx; */
  123 + position: absolute;
  124 + right: 52rpx;
  125 + bottom: 34rpx;
  126 +}
  127 +
  128 +.sousuoheng {
  129 + width: 616rpx;
  130 + height: 73rpx;
  131 + background: rgba(253, 253, 254, 1);
  132 + border: 1rpx solid rgba(153, 153, 153, 1);
  133 + border-radius: 37rpx;
  134 + margin: 70rpx auto 0;
  135 + display: flex;
  136 + align-items: center;
  137 + padding: 0 17rpx;
  138 + box-sizing: border-box;
  139 +}
  140 +
  141 +.souimg {
  142 + width: 46rpx;
  143 + height: 44rpx;
  144 + font-size: 0;
  145 +}
  146 +
  147 +.souimg image {
  148 + width: 100%;
  149 + height: 100%;
  150 +}
  151 +
  152 +.souinput {
  153 + width: 513rpx;
  154 + padding-left: 20rpx;
  155 + position: relative;
  156 +}
  157 +
  158 +.souinput input {
  159 + color: #bababa;
  160 + font-size: 30rpx;
  161 +}
  162 +
  163 +.soucontentbox {
  164 + width: 518rpx;
  165 + height: 488rpx;
  166 + background: #fff;
  167 + overflow-y: scroll;
  168 + position: absolute;
  169 + top: 58rpx;
  170 + left: -1rpx;
  171 +}
  172 +
  173 +.sousuoactive {
  174 + background: #f1f1f1;
  175 +}
  176 +
  177 +.shu {
  178 + width: 0.01rpx;
  179 + height: 73rpx;
  180 + background: #999;
  181 +}
  182 +
  183 +.shurusoucontent {
  184 + color: #bababa;
  185 + font-size: 30rpx;
  186 +}
  187 +
  188 +.historybox {
  189 + padding: 0 72rpx;
  190 + box-sizing: border-box;
  191 + margin-top: 81rpx;
  192 +}
  193 +
  194 +.historyhead {
  195 + display: flex;
  196 + align-items: center;
  197 + justify-content: space-between;
  198 +}
  199 +
  200 +.historyleft {
  201 + color: #bcbcbc;
  202 + font-size: 28rpx;
  203 +}
  204 +
  205 +.historyright {
  206 + width: 22rpx;
  207 + height: 27rpx;
  208 + font-size: 0;
  209 +}
  210 +
  211 +.historyboxcontent {
  212 + display: flex;
  213 + align-items: center;
  214 + flex-wrap: wrap;
  215 +}
  216 +
  217 +.historyboxitem {
  218 + padding: 9rpx 35rpx;
  219 + box-sizing: border-box;
  220 + background: #e2e2e2;
  221 + margin-right: 27rpx;
  222 + margin-top: 25rpx;
  223 + font-size: 28rpx;
  224 + color: #141414;
  225 +}
  226 +
  227 +.sousuoitem {
  228 + padding: 12rpx 20rpx;
  229 + box-sizing: border-box;
  230 + color: #141414;
  231 + font-size: 24rpx;
  232 +}
  233 +.riqidate{
  234 + color:#9E9E9E;
  235 + font-size: 24rpx;
  236 + margin-left:20rpx;
  237 +}
  1 +// pages/sousuo/sousuo.js
  2 +const app = getApp()
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 + textarr: [],
  10 + current: 0,
  11 + imgUrls: [1, 2, 3],
  12 + indicatorDots: false,
  13 + autoplay: true,
  14 + interval: 2000,
  15 + duration: 1000,
  16 + currentSwiper: 0,
  17 + showlabel: false,
  18 + keyword: '',
  19 + //历史记录
  20 + historylist: [],
  21 + noticelist: []
  22 +
  23 + },
  24 +
  25 + /**
  26 + * 生命周期函数--监听页面加载
  27 + */
  28 + onLoad: function(options) {
  29 +
  30 + },
  31 +
  32 + //获取第一个公告列表
  33 + getonedenglu() {
  34 +
  35 + let url = 'index/firstNoticeList'
  36 + app.post(url, '', 'get').then((res) => {
  37 + console.log(res);
  38 + this.setData({
  39 + noticelist: res
  40 + })
  41 + }).catch((err) => {
  42 +
  43 + })
  44 + },
  45 +
  46 + //获取模糊搜索下拉框
  47 + getmohu() {
  48 + let url = 'index/getLikeList';
  49 + let param = {
  50 + keyword: this.data.keyword
  51 + }
  52 + app.post(url, param, 'get').then((res) => {
  53 + console.log(res);
  54 + this.setData({
  55 + textarr: res
  56 + })
  57 + }).catch((err) => {
  58 +
  59 + })
  60 + },
  61 +
  62 + //获取历史记录
  63 + gethistorylist() {
  64 + let that = this;
  65 + let url = 'index/getHistoryList';
  66 +
  67 + app.post(url, '', 'get').then((res) => {
  68 + console.log(res);
  69 +
  70 + for (var obj of res) {
  71 + obj.sel = false
  72 + }
  73 + this.setData({
  74 + historylist: res
  75 + })
  76 +
  77 + }).catch((err) => {
  78 + console.log(err)
  79 + if (err.code == 0) {
  80 + that.setData({
  81 + historylist: []
  82 + })
  83 + }
  84 + })
  85 + },
  86 +
  87 + //长按事件
  88 + handleLongPress(e) {
  89 +
  90 + let token = wx.getStorageSync("token");
  91 + if (token == '') {
  92 + wx.showToast({
  93 + title: '请先登录',
  94 + icon: 'none'
  95 + })
  96 +
  97 + setTimeout(function() {
  98 + wx.navigateTo({
  99 + url: '/pages/login/login',
  100 + })
  101 + }, 1500)
  102 + } else {
  103 + let index = e.currentTarget.dataset.index;
  104 + console.log(index)
  105 + let newhistorylist = this.data.historylist;
  106 + for (var i = 0; i < newhistorylist.length; i++) {
  107 + if (i == index) {
  108 + newhistorylist[i].sel = true
  109 + }
  110 + }
  111 +
  112 + this.setData({
  113 + historylist: newhistorylist
  114 + })
  115 +
  116 + }
  117 +
  118 + },
  119 + //删除全部历史记录
  120 + delhistory() {
  121 + let that = this;
  122 + let token = wx.getStorageSync("token")
  123 + if (token == '') {
  124 + wx.showToast({
  125 + title: '请先登录',
  126 + icon: 'none'
  127 + })
  128 +
  129 + setTimeout(function() {
  130 + wx.navigateTo({
  131 + url: '/pages/login/login',
  132 + })
  133 + }, 1500)
  134 + } else {
  135 + let url = 'index/clearHistory'
  136 + app.post(url, '', 'get').then((res) => {
  137 +
  138 + wx.showToast({
  139 + title: '删除成功',
  140 + icon: "none"
  141 + })
  142 +
  143 + setTimeout(function() {
  144 + that.gethistorylist()
  145 + }, 1000)
  146 +
  147 + }).catch((err) => {
  148 +
  149 + })
  150 + }
  151 +
  152 +
  153 + },
  154 +
  155 + //删除单个历史记录
  156 + shanhistory(e) {
  157 + let that = this;
  158 + let name = e.currentTarget.dataset.name;
  159 + console.log(name)
  160 + let url = 'index/delHistory'
  161 +
  162 + let param = {
  163 + history_name: name
  164 + }
  165 + app.post(url, param, 'get').then((res) => {
  166 +
  167 + wx.showToast({
  168 + title: '删除成功',
  169 + icon: "none"
  170 + })
  171 +
  172 + setTimeout(function() {
  173 + that.gethistorylist()
  174 + }, 1000)
  175 +
  176 + }).catch((err) => {
  177 +
  178 + })
  179 + },
  180 +
  181 + //进入页面
  182 + historyname(e) {
  183 + let name = e.currentTarget.dataset.name;
  184 + wx.navigateTo({
  185 + url: '/pages/gouwucart/gouwucart?name=' + name,
  186 + })
  187 + },
  188 +
  189 + //搜索页面
  190 + soucontent() {
  191 + wx.navigateTo({
  192 + url: '/pages/gouwucart/gouwucart?name=' + this.data.keyword,
  193 + })
  194 + },
  195 +
  196 +
  197 +
  198 + // 轮播图滚动
  199 + swiperChange: function(e) {
  200 + this.setData({
  201 + currentSwiper: e.detail.current
  202 + })
  203 + },
  204 + texttouch(e) {
  205 + this.setData({
  206 + current: e.currentTarget.dataset.index
  207 + })
  208 +
  209 + let name = e.currentTarget.dataset.name
  210 +
  211 + wx.navigateTo({
  212 + url: '/pages/gouwucart/gouwucart?name=' + name,
  213 + })
  214 + },
  215 +
  216 + //显示文本内容
  217 + showsearch() {
  218 + this.setData({
  219 + showlabel: true
  220 + })
  221 + },
  222 + showsearch() {
  223 + let token = wx.getStorageSync("token");
  224 + if (token == '') {
  225 + wx.showToast({
  226 + title: '请先登录',
  227 + icon: 'none'
  228 + })
  229 +
  230 + setTimeout(function() {
  231 + wx.navigateTo({
  232 + url: '/pages/login/login',
  233 + })
  234 + }, 1500)
  235 + }
  236 + },
  237 +
  238 + //输入文本内容
  239 + entersearch(e) {
  240 +
  241 +
  242 + this.setData({
  243 + keyword: e.detail.value
  244 + })
  245 +
  246 + this.getmohu()
  247 +
  248 + if (e.detail.value == '') {
  249 + this.setData({
  250 + showlabel: false
  251 + })
  252 + } else {
  253 + this.setData({
  254 + showlabel: true
  255 + })
  256 + }
  257 +
  258 +
  259 + },
  260 +
  261 + //隐藏更多
  262 + hidegoodshow() {
  263 + this.setData({
  264 + showlabel: false
  265 + })
  266 + },
  267 + //查看更多
  268 + chaknamore() {
  269 +
  270 + let token = wx.getStorageSync("token");
  271 + if (token == '') {
  272 +
  273 + wx.showToast({
  274 + title: '请先登录',
  275 + icon: "none"
  276 + })
  277 +
  278 + setTimeout(function() {
  279 + wx.navigateTo({
  280 + url: '/pages/login/login',
  281 + })
  282 + }, 1500)
  283 +
  284 + } else {
  285 + wx.navigateTo({
  286 + url: '/pages/seemore/seemore',
  287 + })
  288 + }
  289 +
  290 + },
  291 +
  292 +
  293 +
  294 + /**
  295 + * 生命周期函数--监听页面初次渲染完成
  296 + */
  297 + onReady: function() {
  298 +
  299 + },
  300 + toObj(arr) {
  301 + var result = {};
  302 + var p = [];
  303 + for (var a = 0; a < arr.length; a++) {
  304 + result[a] = arr[a];
  305 + p.push(result)
  306 + }
  307 +
  308 + return p;
  309 + },
  310 +
  311 +
  312 + /**
  313 + * 生命周期函数--监听页面显示
  314 + */
  315 + onShow: function() {
  316 + this.getonedenglu();
  317 + //获取历史记录
  318 + this.gethistorylist();
  319 +
  320 + let arr = ['1', '2', '3', '4'];
  321 + console.log(this.toObj(arr))
  322 + },
  323 +
  324 + /**
  325 + * 生命周期函数--监听页面隐藏
  326 + */
  327 + onHide: function() {
  328 +
  329 + },
  330 +
  331 + /**
  332 + * 生命周期函数--监听页面卸载
  333 + */
  334 + onUnload: function() {
  335 +
  336 + },
  337 +
  338 + /**
  339 + * 页面相关事件处理函数--监听用户下拉动作
  340 + */
  341 + onPullDownRefresh: function() {
  342 +
  343 + },
  344 +
  345 + /**
  346 + * 页面上拉触底事件的处理函数
  347 + */
  348 + onReachBottom: function() {
  349 +
  350 + },
  351 +
  352 + /**
  353 + * 用户点击右上角分享
  354 + */
  355 + onShareAppMessage: function() {
  356 +
  357 + }
  358 +})
  1 +{
  2 + "usingComponents": {},
  3 + "navigationBarTitleText": "中源生物"
  4 +}
  1 +<view class="souhead">
  2 + <image src='/img/bg_img.png'></image>
  3 +
  4 +
  5 + <view class="swiper_image">
  6 + <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange">
  7 + <block wx:for="{{noticelist}}" wx:key="">
  8 + <swiper-item style="border-radius:10px;">
  9 + <view class="titlebox">
  10 + <view class="lancolor"></view>
  11 +
  12 + <view class="gonggaobiao">{{item.title}}</view>
  13 + <view class="gonggaocontent">
  14 + {{item.introduce}}
  15 + </view>
  16 +
  17 +
  18 + </view>
  19 + </swiper-item>
  20 + </block>
  21 +
  22 +
  23 + </swiper>
  24 +
  25 + <view class="dots">
  26 + <block wx:for="{{noticelist}}" wx:key="">
  27 + <view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
  28 + </block>
  29 + </view>
  30 +
  31 + </view>
  32 +
  33 + <view class="seemore" bindtap="chaknamore">查看更多></view>
  34 +
  35 +
  36 + <!-- <view class="titlebox">
  37 + <view class="lancolor"></view>
  38 +
  39 + <view class="gonggaobiao">公告标题</view>
  40 + <view class="gonggaocontent">
  41 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.
  42 + </view>
  43 +
  44 + <view class="seemore">查看更多></view>
  45 + </view> -->
  46 +</view>
  47 +
  48 +<view class="headbottom" bindtap="hidegoodshow">
  49 + <view class="sousuoheng">
  50 + <view class="souimg" bindtap="soucontent">
  51 + <image src="/img/souimg.png"></image>
  52 + </view>
  53 +
  54 + <view class="shu"></view>
  55 + <view class="souinput">
  56 + <input placeholder='请输入搜索内容' placeholder-class='shurusoucontent' bindinput="entersearch" bindtap="showsearch"/>
  57 +
  58 + <!-- bindtap="showsearch" -->
  59 +
  60 + <view class="soucontentbox" wx:if="{{showlabel}}">
  61 + <view class="sousuoitem {{current==index?'sousuoactive':''}}" bindtap='texttouch' data-index="{{index}}" wx:for="{{textarr}}" wx:key="" data-name="{{item.name}}">{{item.name}}</view>
  62 + </view>
  63 + </view>
  64 + </view>
  65 + <!-- 历史记录 -->
  66 + <view class="historybox">
  67 + <view class="historyhead">
  68 + <view class="historyleft">历史记录</view>
  69 + <view class="historyright" bindtap="delhistory">
  70 + <image src="/img/delshan.png"></image>
  71 + </view>
  72 + </view>
  73 +
  74 +
  75 +
  76 + <view class="nodata" wx:if="{{historylist.length==0}}">暂无数据</view>
  77 +
  78 + <view class="historyboxcontent">
  79 + <view class="historyboxitem" bindlongpress="handleLongPress" wx:for="{{historylist}}" wx:key='' data-index="{{index}}" bindtap="historyname" data-name="{{item.history_name}}">{{item.history_name}}
  80 +
  81 +
  82 + <view class="chahaoimg" wx:if="{{item.sel==true}}" catchtap='shanhistory' data-name="{{item.history_name}}">
  83 + <image src="/img/chahao.png"></image>
  84 + </view>
  85 +
  86 + </view>
  87 +
  88 + </view>
  89 + </view>
  90 +
  91 +</view>
  1 +page {
  2 + background: #f5f5fa;
  3 +}
  4 +
  5 +.souhead {
  6 + width: 750rpx;
  7 + height: 443rpx;
  8 + font-size: 0;
  9 + position: relative;
  10 +}
  11 +
  12 +.souhead image {
  13 + width: 100%;
  14 + height: 100%;
  15 +}
  16 +
  17 +.swiper_image {
  18 + width: 701rpx;
  19 + height: 368rpx;
  20 + background: #fff;
  21 + border-radius: 28rpx;
  22 + position: absolute;
  23 + top: 62rpx;
  24 + left: 25rpx;
  25 + padding: 26rpx 13rpx;
  26 + box-sizing: border-box;
  27 +}
  28 +
  29 +/* .swiper_image swiper {
  30 + width: 701rpx;
  31 + height: 368rpx;
  32 + background: #fff;
  33 + border-radius: 28rpx;
  34 + position: absolute;
  35 + top: 62rpx;
  36 + left: 25rpx;
  37 + padding: 26rpx 13rpx;
  38 + box-sizing: border-box;
  39 +} */
  40 +
  41 +.titlebox {
  42 + /* width: 701rpx;
  43 + height: 368rpx;
  44 + background: #fff;
  45 + border-radius: 28rpx;
  46 + position: absolute;
  47 + top: 62rpx;
  48 + left: 25rpx;
  49 + */
  50 + padding: 0 10rpx;
  51 + box-sizing: border-box;
  52 +}
  53 +
  54 +.dots {
  55 + /* width: 156rpx; */
  56 + height: 36rpx;
  57 + display: flex;
  58 + flex-direction: row;
  59 + position: absolute;
  60 + justify-content: center;
  61 + left: 0;
  62 + right: 0;
  63 + bottom: 6rpx;
  64 +}
  65 +
  66 +/*未选中时的小圆点样式 */
  67 +
  68 +.dot {
  69 + width: 16rpx;
  70 + height: 16rpx;
  71 + border-radius: 50%;
  72 + margin-right: 26rpx;
  73 + background-color: #b9c0f7;
  74 +}
  75 +
  76 +/*选中以后的小圆点样式 */
  77 +
  78 +.active {
  79 + width: 16rpx;
  80 + height: 16rpx;
  81 + border-radius: 50%;
  82 + background-color: #2681fb;
  83 +}
  84 +
  85 +.lancolor {
  86 + width: 26rpx;
  87 + height: 26rpx;
  88 + border-radius: 50%;
  89 + background: #30a8ff;
  90 +}
  91 +
  92 +.gonggaobiao {
  93 + color: #000;
  94 + font-size: 32rpx;
  95 + text-align: center;
  96 + font-weight: bold;
  97 +}
  98 +
  99 +.gonggaocontent {
  100 + width: 611rpx;
  101 + margin: 42rpx auto 0;
  102 + height: 145rpx;
  103 + overflow-y: scroll;
  104 + color: #000;
  105 + font-size: 26rpx;
  106 +}
  107 +
  108 +.seemore {
  109 + color: #2681fb;
  110 + font-size: 26rpx;
  111 + display: flex;
  112 + justify-content: flex-end;
  113 + /* margin-top: 25rpx; */
  114 + position: absolute;
  115 + right:52rpx;
  116 + bottom:34rpx;
  117 +}
  118 +
  119 +.sousuoheng {
  120 + width: 616rpx;
  121 + height: 73rpx;
  122 + background: rgba(253, 253, 254, 1);
  123 + border: 1rpx solid rgba(153, 153, 153, 1);
  124 + border-radius: 37rpx;
  125 + /* margin: 70rpx auto 0; */
  126 + margin:0 auto;
  127 + display: flex;
  128 + align-items: center;
  129 + padding: 0 17rpx;
  130 + box-sizing: border-box;
  131 +}
  132 +
  133 +.souimg {
  134 + width: 46rpx;
  135 + height: 44rpx;
  136 + font-size: 0;
  137 +}
  138 +
  139 +.souimg image {
  140 + width: 100%;
  141 + height: 100%;
  142 +}
  143 +
  144 +.souinput {
  145 + width: 513rpx;
  146 + padding-left: 20rpx;
  147 + position: relative;
  148 +}
  149 +
  150 +.souinput input {
  151 + color: #bababa;
  152 + font-size: 30rpx;
  153 +}
  154 +
  155 +.soucontentbox {
  156 + width: 518rpx;
  157 + height: 488rpx;
  158 + background: #fff;
  159 + overflow-y: scroll;
  160 + position: absolute;
  161 + top: 58rpx;
  162 + left: -1rpx;
  163 + z-index:99
  164 +}
  165 +
  166 +.sousuoactive {
  167 + background: #f1f1f1;
  168 +}
  169 +
  170 +.shu {
  171 + width: 0.01rpx;
  172 + height: 73rpx;
  173 + background: #999;
  174 +}
  175 +
  176 +.shurusoucontent {
  177 + color: #bababa;
  178 + font-size: 30rpx;
  179 +}
  180 +
  181 +.historybox {
  182 + padding: 0 72rpx;
  183 + box-sizing: border-box;
  184 + margin-top: 81rpx;
  185 +}
  186 +
  187 +.historyhead {
  188 + display: flex;
  189 + align-items: center;
  190 + justify-content: space-between;
  191 +}
  192 +
  193 +.historyleft {
  194 + color: #bcbcbc;
  195 + font-size: 28rpx;
  196 +}
  197 +
  198 +.historyright {
  199 + width: 22rpx;
  200 + height: 27rpx;
  201 + font-size: 0;
  202 +}
  203 +
  204 +.historyboxcontent {
  205 + display: flex;
  206 + align-items: center;
  207 + flex-wrap: wrap;
  208 +}
  209 +
  210 +.historyboxitem {
  211 + padding: 9rpx 35rpx;
  212 + box-sizing: border-box;
  213 + background: #e2e2e2;
  214 + margin-right: 27rpx;
  215 + margin-top: 25rpx;
  216 + font-size: 28rpx;
  217 + color: #141414;
  218 + position: relative
  219 +}
  220 +.chahaoimg{
  221 + width:25rpx;
  222 + height:25rpx;
  223 + font-size: 0;
  224 + position: absolute;
  225 + right:-10rpx;
  226 + top:-10rpx;
  227 + z-index:99
  228 +}
  229 +
  230 +.sousuoitem {
  231 + padding: 12rpx 20rpx;
  232 + box-sizing: border-box;
  233 + color: #141414;
  234 + font-size: 24rpx;
  235 +}
  236 +.headbottom{
  237 + padding-top: 70rpx;
  238 +}
  239 +.nodata{
  240 + color:#999;
  241 + font-size: 30rpx;
  242 + text-align: center;
  243 + padding: 20rpx;
  244 + margin-top:40rpx;
  245 +}
  1 +{
  2 + "description": "项目配置文件",
  3 + "packOptions": {
  4 + "ignore": []
  5 + },
  6 + "setting": {
  7 + "urlCheck": true,
  8 + "es6": true,
  9 + "postcss": true,
  10 + "minified": true,
  11 + "newFeature": true,
  12 + "autoAudits": false,
  13 + "checkInvalidKey": true
  14 + },
  15 + "compileType": "miniprogram",
  16 + "libVersion": "2.8.2",
  17 + "appid": "wx53b10ad00f623dde",
  18 + "projectname": "zhongyuanshengwu",
  19 + "debugOptions": {
  20 + "hidedInDevtools": []
  21 + },
  22 + "isGameTourist": false,
  23 + "simulatorType": "wechat",
  24 + "simulatorPluginLibVersion": {},
  25 + "condition": {
  26 + "search": {
  27 + "current": -1,
  28 + "list": []
  29 + },
  30 + "conversation": {
  31 + "current": -1,
  32 + "list": []
  33 + },
  34 + "plugin": {
  35 + "current": -1,
  36 + "list": []
  37 + },
  38 + "game": {
  39 + "currentL": -1,
  40 + "list": []
  41 + },
  42 + "miniprogram": {
  43 + "current": 7,
  44 + "list": [
  45 + {
  46 + "id": -1,
  47 + "name": "订单详情页",
  48 + "pathName": "pages/orderdetail/orderdetail",
  49 + "query": "",
  50 + "scene": null
  51 + },
  52 + {
  53 + "id": -1,
  54 + "name": "添加客户",
  55 + "pathName": "pages/addkehu/addkehu",
  56 + "query": "",
  57 + "scene": null
  58 + },
  59 + {
  60 + "id": -1,
  61 + "name": "订单列表",
  62 + "pathName": "pages/orderdetail/orderdetail",
  63 + "query": "",
  64 + "scene": null
  65 + },
  66 + {
  67 + "id": -1,
  68 + "name": "我的订单",
  69 + "pathName": "pages/myorder/myorder",
  70 + "query": "",
  71 + "scene": null
  72 + },
  73 + {
  74 + "id": -1,
  75 + "name": "我的客户",
  76 + "pathName": "pages/mykehu/mykehu",
  77 + "query": "",
  78 + "scene": null
  79 + },
  80 + {
  81 + "id": -1,
  82 + "name": "添加新用户",
  83 + "pathName": "pages/addkehu/addkehu",
  84 + "query": "",
  85 + "scene": null
  86 + },
  87 + {
  88 + "id": -1,
  89 + "name": "购物车",
  90 + "pathName": "pages/gouwuche/gouwuche",
  91 + "query": "",
  92 + "scene": null
  93 + },
  94 + {
  95 + "id": -1,
  96 + "name": "商品列表",
  97 + "pathName": "pages/gouwucart/gouwucart",
  98 + "scene": null
  99 + }
  100 + ]
  101 + }
  102 + }
  103 +}
  1 +{
  2 + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
  3 + "rules": [{
  4 + "action": "allow",
  5 + "page": "*"
  6 + }]
  7 +}
  1 +const formatTime = date => {
  2 + const year = date.getFullYear()
  3 + const month = date.getMonth() + 1
  4 + const day = date.getDate()
  5 + const hour = date.getHours()
  6 + const minute = date.getMinutes()
  7 + const second = date.getSeconds()
  8 +
  9 + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
  10 +}
  11 +
  12 +const formatNumber = n => {
  13 + n = n.toString()
  14 + return n[1] ? n : '0' + n
  15 +}
  16 +
  17 +module.exports = {
  18 + formatTime: formatTime
  19 +}