achao 1 year ago
parent
commit
2688efccff

+ 4 - 4
unimall-admin/config/dev.env.js

@@ -1,8 +1,8 @@
 module.exports = {
     NODE_ENV: '"development"',
     ENV_CONFIG: '"dev"',
-    // HOST: '"http://192.168.110.82:8181"',
-    // BASE_API: '"http://192.168.110.82:8181/m.api"'
-    HOST: '"http://192.168.110.175:8181"',
-    BASE_API: '"http://192.168.110.175:8181/m.api"'
+    HOST: '"http://192.168.110.82:8999"',
+    BASE_API: '"http://192.168.110.82:8999/m.api"'
+        // HOST: '"http://121.5.163.150:8999"',
+        // BASE_API: '"http://121.5.163.150:8999/m.api"'
 }

+ 68 - 68
unimall-admin/config/index.js

@@ -5,84 +5,84 @@
 const path = require('path')
 
 module.exports = {
-  dev: {
-    // Paths
-    assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
-    proxyTable: {},
+    dev: {
+        // Paths
+        assetsSubDirectory: 'static',
+        assetsPublicPath: '/',
+        proxyTable: {},
 
-    // Various Dev Server settings
+        // Various Dev Server settings
 
-    // can be overwritten by process.env.HOST
-    // if you want dev by ip, please set host: '0.0.0.0'
-    host: 'localhost',
-    port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
-    autoOpenBrowser: true,
-    errorOverlay: true,
-    notifyOnErrors: false,
-    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
+        // can be overwritten by process.env.HOST
+        // if you want dev by ip, please set host: '0.0.0.0'
+        host: 'localhost',
+        port: 9527, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
+        autoOpenBrowser: true,
+        errorOverlay: true,
+        notifyOnErrors: false,
+        poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
 
-    // Use Eslint Loader?
-    // If true, your code will be linted during bundling and
-    // linting errors and warnings will be shown in the console.
-    useEslint: true,
-    // If true, eslint errors and warnings will also be shown in the error overlay
-    // in the browser.
-    showEslintErrorsInOverlay: false,
+        // Use Eslint Loader?
+        // If true, your code will be linted during bundling and
+        // linting errors and warnings will be shown in the console.
+        useEslint: false,
+        // If true, eslint errors and warnings will also be shown in the error overlay
+        // in the browser.
+        showEslintErrorsInOverlay: false,
 
-    /**
-     * Source Maps
-     */
+        /**
+         * Source Maps
+         */
 
-    // https://webpack.js.org/configuration/devtool/#development
-    devtool: 'source-map',
+        // https://webpack.js.org/configuration/devtool/#development
+        devtool: 'source-map',
 
-    // CSS Sourcemaps off by default because relative paths are "buggy"
-    // with this option, according to the CSS-Loader README
-    // (https://github.com/webpack/css-loader#sourcemaps)
-    // In our experience, they generally work as expected,
-    // just be aware of this issue when enabling this option.
-    cssSourceMap: false
-  },
+        // CSS Sourcemaps off by default because relative paths are "buggy"
+        // with this option, according to the CSS-Loader README
+        // (https://github.com/webpack/css-loader#sourcemaps)
+        // In our experience, they generally work as expected,
+        // just be aware of this issue when enabling this option.
+        cssSourceMap: false
+    },
 
-  build: {
-    // Template for index.html
-    index: path.resolve(__dirname, '../dist/index.html'),
+    build: {
+        // Template for index.html
+        index: path.resolve(__dirname, '../dist/index.html'),
 
-    // Paths
-    assetsRoot: path.resolve(__dirname, '../dist'),
-    assetsSubDirectory: 'static',
+        // Paths
+        assetsRoot: path.resolve(__dirname, '../dist'),
+        assetsSubDirectory: 'static',
 
-    /**
-     * You can set by youself according to actual condition
-     * You will need to set this if you plan to deploy your site under a sub path,
-     * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
-     * then assetsPublicPath should be set to "/bar/".
-     * In most cases please use '/' !!!
-     */
-    assetsPublicPath: '/',
+        /**
+         * You can set by youself according to actual condition
+         * You will need to set this if you plan to deploy your site under a sub path,
+         * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
+         * then assetsPublicPath should be set to "/bar/".
+         * In most cases please use '/' !!!
+         */
+        assetsPublicPath: '/',
 
-    /**
-     * Source Maps
-     */
-    productionSourceMap: false,
-    // https://webpack.js.org/configuration/devtool/#production
-    devtool: 'source-map',
+        /**
+         * Source Maps
+         */
+        productionSourceMap: false,
+        // https://webpack.js.org/configuration/devtool/#production
+        devtool: 'source-map',
 
-    // Gzip off by default as many popular static hosts such as
-    // Surge or Netlify already gzip all static assets for you.
-    // Before setting to `true`, make sure to:
-    // npm install --save-dev compression-webpack-plugin
-    productionGzip: false,
-    productionGzipExtensions: ['js', 'css'],
+        // Gzip off by default as many popular static hosts such as
+        // Surge or Netlify already gzip all static assets for you.
+        // Before setting to `true`, make sure to:
+        // npm install --save-dev compression-webpack-plugin
+        productionGzip: false,
+        productionGzipExtensions: ['js', 'css'],
 
-    // Run the build command with an extra argument to
-    // View the bundle analyzer report after build finishes:
-    // `npm run build:prod --report`
-    // Set to `true` or `false` to always turn it on or off
-    bundleAnalyzerReport: process.env.npm_config_report || false,
+        // Run the build command with an extra argument to
+        // View the bundle analyzer report after build finishes:
+        // `npm run build:prod --report`
+        // Set to `true` or `false` to always turn it on or off
+        bundleAnalyzerReport: process.env.npm_config_report || false,
 
-    // `npm run build:prod --generate_report`
-    generateAnalyzerReport: process.env.npm_config_generate_report || false
-  }
-}
+        // `npm run build:prod --generate_report`
+        generateAnalyzerReport: process.env.npm_config_generate_report || false
+    }
+}

+ 5 - 5
unimall-admin/config/prod.env.js

@@ -1,6 +1,6 @@
 module.exports = {
-	NODE_ENV: '"production"',
-  	ENV_CONFIG: '"prod"',
-    HOST: '"http://123.56.171.94:8181"',
-    BASE_API: '"http://123.56.171.94:8181/m.api"'
-}
+    NODE_ENV: '"production"',
+    ENV_CONFIG: '"prod"',
+    HOST: '"http://121.5.163.150:8999"',
+    BASE_API: '"http://121.5.163.150:8999/m.api"'
+}

+ 1 - 1
unimall-admin/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="renderer" content="webkit">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-    <title>电商后台管理</title>
+    <title>会员管理系统</title>
   </head>
   <body>
     <script src=<%= BASE_URL %>/tinymce4.7.5/tinymce.min.js></script>

+ 2 - 74
unimall-admin/src/router/route.json

@@ -1,49 +1,4 @@
-[
-
-    {
-        "redirect": "noredirect",
-        "path": "/sys",
-        "children": [{
-            "path": "admin",
-            "meta": {
-                "noCache": true,
-                "icon": "admin",
-                "perms": [
-                    "admin:admin:list",
-                    "admin:admin:create",
-                    "admin:admin:update",
-                    "admin:admin:delete"
-                ],
-                "title": "管理员"
-            },
-            "name": "admin",
-            "page": "/sys/admin"
-        }, {
-            "path": "role",
-            "meta": {
-                "noCache": true,
-                "icon": "role",
-                "perms": [
-                    "admin:role:list",
-                    "admin:role:create",
-                    "admin:role:delete",
-                    "admin:role:update",
-                    "admin:role:permissionList",
-                    "admin:permission:list"
-                ],
-                "title": "角色管理"
-            },
-            "name": "role",
-            "page": "/sys/role"
-        }],
-        "meta": {
-            "icon": "sys",
-            "title": "系统管理"
-        },
-        "name": "sysManage",
-        "alwaysShow": true
-    },
-    {
+[{
         "redirect": "noredirect",
         "name": "sysTools",
         "path": "/tools",
@@ -94,8 +49,7 @@
             }
 
         ]
-    },
-    {
+    }, {
         "redirect": "noredirect",
         "name": "management",
         "path": "/management",
@@ -146,32 +100,6 @@
             }
         ]
     },
-    {
-        "redirect": "noredirect",
-        "name": "sysLog",
-        "path": "/log",
-        "meta": {
-            "icon": "log",
-            "title": "日志管理"
-        },
-        "alwaysShow": true,
-        "children": [{
-            "path": "logininfor",
-            "name": "logininfor",
-            "page": "/log/logininfor",
-            "meta": {
-                "title": "登陆日志",
-                "icon": "logininfor",
-                "noCache": true,
-                "perms": [
-                    "log:logininfor:list",
-                    "log:logininfor:create",
-                    "log:logininfor:delete",
-                    "log:logininfor:update"
-                ]
-            }
-        }]
-    },
     {
         "redirect": "noredirect",
         "path": "/profile",

+ 1 - 1
unimall-admin/src/views/login/index.vue

@@ -11,7 +11,7 @@
           class="img"
           src="@/assets/avatar.png"
           alt="">
-        <p class="title">电商后台登录</p>
+        <p class="title">会员管理系统</p>
       </div>
       <div class="login-border">
         <div class="login-main">

+ 23 - 2
unimall-admin/src/views/management/index.vue

@@ -278,7 +278,7 @@
         <div class="row" style="margin-bottom: 10px;">
           <span>{{ item.gmtCreate }}</span>
           <span>{{ item.serviceObject==1?"充值":"消费" }}</span>
-          <span>{{ item.money }}</span>
+          <span>{{ item.money }}</span>
         </div>
       </div>
     </el-dialog>
@@ -545,6 +545,22 @@ export default {
     submitForm: function() {
       this.$refs['form'].validate(valid => {
         if (valid) {
+          if (!this.form.userName) {
+            this.msgError('姓名不能为空!')
+            return
+          }
+          if (!this.form.phone) {
+            this.msgError('手机号不能为空!')
+            return
+          }
+          if (!this.form.cartNo) {
+            this.msgError('卡号不能为空!')
+            return
+          }
+          if (!this.form.cartName) {
+            this.msgError('卡名称不能为空!')
+            return
+          }
           if (this.form.id != undefined) {
             if (this.isCZ) {
               chongzhi({
@@ -574,6 +590,7 @@ export default {
                 }
               })
             } else {
+              this.form.status = '正常'
               updateManagement(this.form).then(response => {
                 if (response.data) {
                   this.msgSuccess('修改成功')
@@ -587,8 +604,12 @@ export default {
           } else {
             this.form.remark1 = this.form.money
             this.form.status = '正常'
-            addManagement(this.form).then(response => {
+            addManagement(this.form).then(response => { debugger
               if (response.data) {
+                if (!response.data.data) {
+                  this.msgError('手机号或卡号重复')
+                  return
+                }
                 this.msgSuccess('新增成功')
                 this.open = false
                 this.getList()

+ 1 - 2
unimall-admin/src/views/managementToday/index.vue

@@ -288,7 +288,6 @@ export default {
           }
         }
       })
-
       return sums
     },
     /** 查询会员管理列表 */
@@ -378,7 +377,7 @@ export default {
               }
             })
           } else {
-            addManagement(this.form).then(response => {
+            addManagement(this.form).then(response => { debugger
               if (response.data) {
                 this.msgSuccess('新增成功')
                 this.open = false

+ 31 - 3
unimall-admin/src/views/moneyHis/index.vue

@@ -136,13 +136,14 @@
       </el-col> -->
     </el-row>
 
-    <el-table v-loading="loading" :data="moneyHisList" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="moneyHisList" :summary-method="getSummaries" show-summary @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <!-- <el-table-column label="" align="center" prop="id" />
       <el-table-column label="" align="center" prop="xiaofeiId" />
       <el-table-column label="" align="center" prop="companyId" /> -->
       <el-table-column label="姓名" align="center" prop="remark1" />
       <el-table-column label="电话" align="center" prop="remark2" />
+      <el-table-column label="卡号" align="center" prop="remark3" />
       <!-- <el-table-column label="消费" align="center" prop="serviceObject" /> -->
       <el-table-column label="消费" align="center" prop="gmtCreate" width="180">
         <template slot-scope="scope">
@@ -169,13 +170,13 @@
       <el-table-column label="" align="center" prop="adminId" /> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             v-permission="['unimall:moneyHis:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-          >修改</el-button>
+          >修改</el-button> -->
           <el-button
             v-permission="['unimall:moneyHis:remove']"
             size="mini"
@@ -317,6 +318,33 @@ export default {
     this.getList()
   },
   methods: {
+    getSummaries(param) {
+      if (!this.queryParams.serviceObject) return
+      const { columns, data } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '总价'
+          return
+        } else if (index==4) {
+          const values = data.map(item => Number(item[column.property]))
+          if (!values.every(value => isNaN(value))) {
+            sums[index] = values.reduce((prev, curr) => {
+              const value = Number(curr)
+              if (!isNaN(value)) {
+                return prev + curr
+              } else {
+                return prev
+              }
+            }, 0)
+            sums[index] += ' 元'
+          } else {
+            sums[index] = 'N/A'
+          }
+        }
+      })
+      return sums
+    },
     /** 查询充值消费记录列表 */
     getList() {
       this.loading = true

+ 112 - 26
unimall-admin/src/views/salesSlip/index.vue

@@ -4,9 +4,9 @@
       <el-form-item>
         <div style="display:flex">
           <el-input
-            v-model="phone"
+            v-model="cartNo"
             placeholder="
-            请输入手机号"
+            请输入号"
             clearable
             size="small"
             style="margin-right: 20px;width: 200px;"
@@ -32,6 +32,10 @@
               <span>余额:</span>
               <span>{{ memberInfo.money }}</span>
             </div>
+            <div class="row">
+              <span>卡状态:</span>
+              <span>{{ memberInfo.status }}</span>
+            </div>
           </div>
 
         </div>
@@ -185,28 +189,30 @@
           size="mini"
           @click="handleDelete">删除</el-button>
       </el-col>
-      <el-col :span="1.5">
+      <!-- <el-col :span="1.5">
         <el-button
           v-permission="['unimall:salesSlip:export']"
           type="warning"
           icon="el-icon-download"
           size="mini"
           @click="handleExport">导出</el-button>
-      </el-col>
+      </el-col> -->
     </el-row>
 
-    <el-table v-loading="loading" :data="salesSlipList" @selection-change="handleSelectionChange">
+    <el-table v-loading="loading" :data="salesSlipList" :summary-method="getSummaries" show-summary @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <!-- <el-table-column label="" align="center" prop="id" />
       <el-table-column label="" align="center" prop="companyId" /> -->
       <el-table-column label="姓名" align="center" prop="remark1" />
       <el-table-column label="电话" align="center" prop="remark2" />
+      <el-table-column label="卡号" align="center" prop="remark3" />
       <el-table-column label="服务对象" align="center" prop="serviceObject" />
       <el-table-column label="服务分类" align="center" prop="serviceType" />
       <el-table-column label="颜色" align="center" prop="color" />
       <el-table-column label="属性" align="center" prop="attribute" />
       <el-table-column label="服务项目" align="center" prop="serviceItems" />
       <el-table-column label="金额" align="center" prop="money" />
+      <el-table-column label="数量" align="center" prop="count" />
       <!-- <el-table-column label="状态" align="center" prop="status" /> -->
 
       <!-- <el-table-column label="备注3" align="center" prop="remark3" /> -->
@@ -249,7 +255,7 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList" />
     <el-dialog :visible.sync="isShowPrint" title="打印小票" width="400px">
-      <div id="box">
+      <div id="box" style="font-size: 12px;">
         <div class="print-row">
           <span>姓名:</span>
           <span>{{ printData.remark1 }}</span>
@@ -258,6 +264,10 @@
           <span>电话:</span>
           <span>{{ printData.remark2 }}</span>
         </div>
+        <div class="print-row">
+          <span>卡号:</span>
+          <span>{{ printData.remark3 }}</span>
+        </div>
         <div class="print-row">
           <span>服务对象:</span>
           <span>{{ printData.serviceObject }}</span>
@@ -278,6 +288,10 @@
           <span>服务项目:</span>
           <span>{{ printData.serviceItems }}</span>
         </div>
+        <div class="print-row">
+          <span>数量:</span>
+          <span>{{ printData.count }}</span>
+        </div>
         <div class="print-row">
           <span>金额:</span>
           <span>{{ printData.money }}</span>
@@ -293,7 +307,7 @@
       </div>
     </el-dialog>
     <!-- 添加或修改销售单对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px">
+    <el-dialog :title="title" :visible.sync="open" width="1000px">
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <!-- <el-form-item label="" prop="companyId">
           <el-input v-model="form.companyId" placeholder="请输入" />
@@ -304,6 +318,9 @@
         <el-form-item label="电话" prop="remark2">
           <el-input v-model="form.remark2" placeholder="请输入电话" disabled/>
         </el-form-item>
+        <el-form-item label="卡号" prop="remark3">
+          <el-input v-model="form.remark3" placeholder="请输入卡号" disabled/>
+        </el-form-item>
         <el-form-item label="服务对象" prop="serviceObject">
           <!-- <el-input v-model="form.serviceObject" placeholder="请输入服务对象" /> -->
           <el-select v-model="form.serviceObject" placeholder="请选择服务对象" style="width:100%">
@@ -327,10 +344,16 @@
             <el-option v-for="item in attributeList" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
         </el-form-item>
+        <el-form-item label="数量" prop="count">
+          <el-input v-model="form.count" placeholder="请输入数量" type="number" @input="inputVal"/>
+        </el-form-item>
         <el-form-item label="服务项目" prop="serviceItems">
           <!-- <el-input v-model="form.serviceItems" placeholder="请输入服务项目" /> -->
-          <el-checkbox-group v-model="checkList" @change="changeCheckbox">
-            <el-checkbox v-for="item in serviceList" :label="item.route" :key="item.id"/>
+          <el-checkbox-group v-model="checkList" style="display: flex;" @change="changeCheckbox">
+            <div v-for="(item,index) in serviceList" :key="index" style="margin-right: 20px;">
+              <el-checkbox :label="item.route" :key="item.id"/>
+            <el-input v-model="item.unitPrice" placeholder="价格" style="width: 50px;" @input="inputVal(item)"/></div>
+
           </el-checkbox-group>
         </el-form-item>
         <el-form-item label="金额" prop="money">
@@ -396,7 +419,7 @@ export default {
         id: 'box'
         // 其他配置项,
       },
-      phone: '',
+      cartNo: '',
       serviceType: [{
         name: '鞋类清洗',
         id: 1
@@ -459,10 +482,13 @@ export default {
         gmtCreate: undefined,
         gmtUpdate: undefined,
         userId: undefined,
-        adminId: undefined
+        adminId: undefined,
+        cartNo: undefined
       },
       // 表单参数
-      form: {},
+      form: {
+
+      },
       // 表单校验
       rules: {
         deleteFlag: [
@@ -475,28 +501,73 @@ export default {
     this.getList()
   },
   methods: {
+    inputVal(val) { debugger
+      console.log(this.serviceList)
+      const that = this
+      this.form.money = 0
+      const getPlace = function(name) {
+        for (let k = 0; k<that.serviceList.length; k++) {
+          if (name==that.serviceList[k].route) {
+            return Number(that.serviceList[k].unitPrice)
+          }
+        }
+      }
+      for (let i = 0; i<this.checkList.length; i++) {
+        this.form.money+=(Number(getPlace(this.checkList[i]))*this.form.count)
+      }
+    },
+    getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '总价'
+          return
+        } else if (index==9) {
+          const values = data.map(item => Number(item[column.property]))
+          if (!values.every(value => isNaN(value))) {
+            sums[index] = values.reduce((prev, curr) => {
+              const value = Number(curr)
+              if (!isNaN(value)) {
+                return prev + curr
+              } else {
+                return prev
+              }
+            }, 0)
+            sums[index] += ' 元'
+          } else {
+            sums[index] = 'N/A'
+          }
+        }
+      })
+
+      return sums
+    },
     print(row) {
       this.printData = row
       this.isShowPrint = true
     },
     getMember() {
-      listManagement({
-        phone: this.phone
-      }).then(response => {
-        if (response.data.data.items.length!=0) {
-          this.memberInfo = response.data.data.items[0]
-        } else {
-          this.msgError('暂无此会员')
-          return
-        }
-      })
+      if (this.cartNo) {
+        listManagement({
+          cartNo: this.cartNo
+        }).then(response => {
+          if (response.data.data.items.length!=0) {
+            this.memberInfo = response.data.data.items[0]
+          } else {
+            this.msgError('暂无此会员')
+            return
+          }
+        })
+      } else {
+        this.msgError('请输入会员卡号')
+      }
     },
     submitMember() {},
     changeCheckbox(e) {
       const that = this
       this.form.money = 0
       console.log(this.checkList)
-      debugger
       const getPlace = function(name) {
         for (let k = 0; k<that.serviceList.length; k++) {
           if (name==that.serviceList[k].route) {
@@ -505,7 +576,7 @@ export default {
         }
       }
       for (let i = 0; i<this.checkList.length; i++) {
-        this.form.money+=getPlace(this.checkList[i])
+        this.form.money+=(Number(getPlace(this.checkList[i]))*this.form.count)
       }
     },
     /** 查询销售单列表 */
@@ -544,7 +615,8 @@ export default {
         gmtCreate: undefined,
         gmtUpdate: undefined,
         userId: undefined,
-        adminId: undefined
+        adminId: undefined,
+        count: 1
       }
       this.resetForm('form')
     },
@@ -575,6 +647,7 @@ export default {
       this.title = '添加销售单'
       this.form.remark1 = this.memberInfo.userName
       this.form.remark2 = this.memberInfo.phone
+      this.form.remark3 = this.memberInfo.cartNo
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -590,6 +663,18 @@ export default {
     submitForm: function () {
       this.$refs['form'].validate(valid => {
         if (valid) {
+          if (!this.form.count) {
+            this.msgError('数量不能为空!')
+            return
+          }
+          if (this.form.count<1) {
+            this.msgError('数量不能小于1!')
+            return
+          }
+          if (this.checkList.length<=0) {
+            this.msgError('请勾选服务项目!')
+            return
+          }
           if (this.form.id != undefined) {
             updateSalesSlip(this.form).then(response => {
               if (response.data) {
@@ -614,7 +699,8 @@ export default {
                   serviceObject: 2,
                   money: this.form.money,
                   remark1: this.memberInfo.userName,
-                  remark2: this.memberInfo.phone
+                  remark2: this.memberInfo.phone,
+                  remark3: this.memberInfo.cartNo
 
                 }).then(response => {
                   if (response.data) {