Browse Source

录入员

afa 5 tháng trước cách đây
mục cha
commit
a6030a9fc1

+ 4 - 7
app/admin/controller/shop/CustomerSpec.php

@@ -12,7 +12,7 @@ use app\common\model\StockConfig;
 use think\facade\Db;
 use app\common\model\ProductConfig;
 use app\api\service\SpecService;
-use app\common\model\CustomerSpec as CustomerSpecModel;
+use app\common\model\CustomerSpecBack as CustomerSpecModel;
 
 #[Group("shop/customer_spec")]
 class CustomerSpec extends Backend
@@ -29,9 +29,8 @@ class CustomerSpec extends Backend
     {
         parent::_initialize();
         $this->model = new CustomerSpecModel();
-        $this->assign('customerList', Customer::where('status', 1)->column('name','id'));
-        $this->assign('fieldList', StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title','id'));
-         $this->relationField=['customer'];
+        $this->assign('typeList',  StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title','id'));
+        $this->relationField=['customer'];
     }
 
     //查看
@@ -102,9 +101,7 @@ class CustomerSpec extends Backend
             if (!$row) {
                 $this->error(__('没有找到记录'));
             }
-            $row->customer_id = (string)$row->customer_id;
-            $row->specs = json_decode($row->specs, true);
-            $row->variety = json_decode($row->variety, true);
+         
             $this->assign('row', $row);
             return $this->fetch();
         }

+ 2 - 2
app/admin/controller/shop/ShopList.php

@@ -10,7 +10,7 @@ use app\admin\traits\Actions;
 use app\common\model\Customer;
 use app\common\model\User;
 use app\common\model\StockConfig;
-use app\common\model\CustomerSpec;
+use app\common\model\CustomerSpecBack;
 use app\api\service\SpecService;
 use app\common\model\ShopList as ShopListModel;
 
@@ -68,7 +68,7 @@ class ShopList extends Backend
             $customer_id = $this->request->get('customer_id/d', 0);
             $type_id = $this->request->get('type_id/d', 0);
             if(empty($type_id) || empty($customer_id)) return resp_json(0, '参数错误');
-            $rows = CustomerSpec::where('customer_id', $customer_id)->order('sort desc')->find();
+            $rows = CustomerSpecBack::where('customer_id', $customer_id)->order('sort desc')->find();
             if($rows->specs){
                 $specs = json_decode($rows->specs, true);
                 $result = SpecService::getSpecsList($type_id, $specs);

+ 19 - 2
app/admin/view/shop/customer/index.html

@@ -44,12 +44,29 @@
                     field: 'operate',
                     title: __('操作'),
                     width:150,
-                    action:{sort:true,edit:true,del:true}
+                      action:{
+                        spec:{
+                            tooltip:true,
+                            icon:'fa fa-list',
+                            type:'info',
+                            text:__('关联规格'),
+                            method:'spec'
+                        },
+                        edit:true,
+                        del:true
+                    }
                 }
             ]
         },
         methods: {
-        
+            spec:function (row){
+                Yunqi.api.open({
+                    url:'shop/customer_spec/add',
+                    width:1000,
+                    title:__('关联规格'),
+                    icon:'fa fa-list'
+                });
+            },
         }
     }
 </script>

+ 137 - 0
app/admin/view/shop/customer/spec_back.html

@@ -0,0 +1,137 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+
+        <el-form ref="form" :model="form" label-width="80px" border stripe>
+
+            <el-form-item label="客户名称">
+                <el-select v-model="value" placeholder="请选择" @change="changeCustomer">
+                    <el-option
+                      v-for="item in customerList"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value">
+                    </el-option>
+                  </el-select>
+            </el-form-item>
+
+            <el-form-item label="品种">
+                <el-checkbox-group v-model="form.nameValue">
+                    <el-checkbox :label="item.label" :value="JSON.stringify(item)" v-for="(item, index) in options"
+                        :key="index" @change="changeType">
+                    </el-checkbox>
+                </el-checkbox-group>
+            </el-form-item>
+            <el-form-item label="规格">
+                <el-table :data="tableData" style="border: 1px solid rgb(235, 235, 235); border-radius: 6px">
+                    <el-table-column prop="name" label="规格" width="200">
+                    </el-table-column>
+
+                    <el-table-column prop="price" label="发货价格" align="center">
+                        <template #default="{row}">
+                            <el-input v-model="row.price" placeholder="发货价格"></el-input>
+                        </template>
+                    </el-table-column>
+                    <el-table-column  label="操作" width="120" header-align="right">
+                        <template  #default="scope">
+                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text"
+                                size="small">
+                                移除
+                            </el-button>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </el-form-item>
+            <el-form-item>
+                <el-button type="primary" @click="onSubmit">立即创建</el-button>
+                <el-button>取消</el-button>
+            </el-form-item>
+        </el-form>
+    </el-card>
+</template>
+<script>
+    import form from "@components/Form.js";
+    var typeList = [], boxList = [], customerList = [], customer = 0;
+    export default {
+        components: { 'YunForm': form },
+        data() {
+            return {
+                row: Yunqi.data.row,
+                tableData: [],
+                value: "",
+                form: {
+                    nameValue: [],
+                },
+                options: typeList,
+                customerList: customerList,
+            }
+        },
+        methods: {
+            //获取客户
+            changeCustomer: function (data) {
+                customer =data
+            },
+            //获取规格
+            changeType: function (data, row) {
+                let obj = JSON.parse(row.target.value);
+
+                //品种去重
+                let idx = boxList.findIndex(item => item.value == obj.value);
+                if (idx != -1) {
+                    boxList.splice(idx, 1)
+                }else{
+                    boxList.push({ label: obj.label, value: obj.value });
+                }
+                Yunqi.ajax.get('shop/customer_spec/get_box', { type_id: obj.value }, false, false, true).then(res => {
+                    //编辑数据
+                    if (res.length > 0) {
+                        for (var key in Object(res)) {
+                            let index = this.tableData.findIndex(item => item.value == res[key]['id']);
+                            if (index != -1) {
+                            
+                                this.tableData.splice(index, 1)
+                            } else {
+                           
+                                this.tableData.push({ name: res[key]['title'], value: res[key]['id'], price: res[key]['price'], type_id:obj.value, type_name: obj.label });
+                            }
+                        }
+                    }
+                });
+            },
+            onSubmit() {
+                //获取规格
+                if (this.tableData == "" || boxList.length == 0 || customer=="") return;
+                Yunqi.ajax.post('shop/customer_spec/add', {customer_id: customer, type_list: boxList, type_box: this.tableData }, false, false, true).then(res => {
+                    if (res.code == 200) {
+                        this.$message.success(__('设置成功'));
+                        Yunqi.api.closelayer(Yunqi.app.window.id, true);
+                    } else {
+                        this.$message.error(res.msg);
+                        return false;
+                    }
+                });
+
+            },
+
+            deleteRow(index, rows) {
+                rows.splice(index, 1);
+            }
+        },
+        onLoad: function () {
+            
+            let type = Yunqi.data.fieldList;
+            //全部品种
+            for (var key in Object(type)) {
+                typeList.push({ label: type[key], value: key });
+            }
+            //全部客户
+            let customer = Yunqi.data.customerList;
+            for (var key in Object(customer)) {
+                customerList.push({ label: customer[key], value: key });
+            }
+            
+        },
+    }
+</script>
+<style>
+
+</style>

+ 111 - 110
app/admin/view/shop/customer_spec/add.html

@@ -1,137 +1,138 @@
 <template>
-    <el-card shadow="never" style="border: 0;">
 
-        <el-form ref="form" :model="form" label-width="80px" border stripe>
+    <el-card shadow="never">
+        <el-tabs v-model="activeName" @tab-click="handleClick">
+            <el-tab-pane label="用户管理" name="first">
+                <template>
+                    <el-table :data="tableData" style="width: 100%">
+                    <el-table-column prop="date" label="日期" width="180"></el-table-column>
+                    <el-table-column prop="name" label="姓名" width="180"></el-table-column>
+                    <el-table-column prop="address" label="地址"></el-table-column>
+                    </el-table>
+                </template>
 
-            <el-form-item label="客户名称">
-                <el-select v-model="value" placeholder="请选择" @change="changeCustomer">
-                    <el-option
-                      v-for="item in customerList"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value">
-                    </el-option>
-                  </el-select>
-            </el-form-item>
-
-            <el-form-item label="品种">
-                <el-checkbox-group v-model="form.nameValue">
-                    <el-checkbox :label="item.label" :value="JSON.stringify(item)" v-for="(item, index) in options"
-                        :key="index" @change="changeType">
-                    </el-checkbox>
-                </el-checkbox-group>
+            </el-tab-pane>
+            <el-tab-pane label="配置管理" name="second">配置管理2</el-tab-pane>
+            <el-tab-pane label="角色管理" name="third">角色管理</el-tab-pane>
+            <el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane>
+        </el-tabs>
+    </el-card>
+    <!-- <el-card shadow="never">
+        <el-form ref="form" :model="form" label-width="0"  stripe>
+            <el-form-item>
+                <yun-table :columns="columns" :common-search="false" :pagination="false" tabs="type" toolbar=""
+                    :common-search="false" :search-form-visible="false" :extend="extend">
+                </yun-table>
             </el-form-item>
-            <el-form-item label="规格">
-                <el-table :data="tableData" style="border: 1px solid rgb(235, 235, 235); border-radius: 6px">
-                    <el-table-column prop="name" label="规格" width="200">
-                    </el-table-column>
+           
 
-                    <el-table-column prop="price" label="发货价格" align="center">
-                        <template #default="{row}">
-                            <el-input v-model="row.price" placeholder="发货价格"></el-input>
-                        </template>
-                    </el-table-column>
-                    <el-table-column  label="操作" width="120" header-align="right">
-                        <template  #default="scope">
-                            <el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text"
-                                size="small">
-                                移除
-                            </el-button>
-                        </template>
-                    </el-table-column>
-                </el-table>
-            </el-form-item>
             <el-form-item>
                 <el-button type="primary" @click="onSubmit">立即创建</el-button>
                 <el-button>取消</el-button>
             </el-form-item>
         </el-form>
-    </el-card>
+    </el-card> -->
 </template>
 <script>
-    import form from "@components/Form.js";
-    var typeList = [], boxList = [], customerList = [], customer = 0;
+    import table from "@components/Table.js";
     export default {
-        components: { 'YunForm': form },
+        components: { 'YunTable': table },
         data() {
             return {
-                row: Yunqi.data.row,
-                tableData: [],
-                value: "",
-                form: {
-                    nameValue: [],
-                },
-                options: typeList,
-                customerList: customerList,
-            }
+                activeName: 'first',
+                tableData: [{
+                    date: '2016-05-02',
+                    name: '王小虎',
+                    address: '上海市普陀区金沙江路 1518 弄'
+                }, {
+                    date: '2016-05-04',
+                    name: '王小虎',
+                    address: '上海市普陀区金沙江路 1517 弄'
+                }, {
+                    date: '2016-05-01',
+                    name: '王小虎',
+                    address: '上海市普陀区金沙江路 1519 弄'
+                }, {
+                    date: '2016-05-03',
+                    name: '王小虎',
+                    address: '上海市普陀区金沙江路 1516 弄'
+                }]
+            };
         },
-        methods: {
-            //获取客户
-            changeCustomer: function (data) {
-                customer =data
+        /*data: {
+            extend: {
+                index_url: 'general/category/index',
             },
-            //获取规格
-            changeType: function (data, row) {
-                let obj = JSON.parse(row.target.value);
+            columns: [
+                { checkbox: true },
+                { field: 'type', title: __('规格'), width: 120, searchList: Yunqi.data.typeList},
+                { field: 'nickname', title: __('包装箱'), formatter: Yunqi.formatter.select },
 
-                //品种去重
-                let idx = boxList.findIndex(item => item.value == obj.value);
-                if (idx != -1) {
-                    boxList.splice(idx, 1)
-                }else{
-                    boxList.push({ label: obj.label, value: obj.value });
-                }
-                Yunqi.ajax.get('shop/customer_spec/get_box', { type_id: obj.value }, false, false, true).then(res => {
-                    //编辑数据
-                    if (res.length > 0) {
-                        for (var key in Object(res)) {
-                            let index = this.tableData.findIndex(item => item.value == res[key]['id']);
-                            if (index != -1) {
-                            
-                                this.tableData.splice(index, 1)
-                            } else {
-                           
-                                this.tableData.push({ name: res[key]['title'], value: res[key]['id'], price: res[key]['price'], type_id:obj.value, type_name: obj.label });
-                            }
-                        }
-                    }
-                });
-            },
-            onSubmit() {
-                //获取规格
-                if (this.tableData == "" || boxList.length == 0 || customer=="") return;
-                Yunqi.ajax.post('shop/customer_spec/add', {customer_id: customer, type_list: boxList, type_box: this.tableData }, false, false, true).then(res => {
-                    if (res.code == 200) {
-                        this.$message.success(__('设置成功'));
-                        Yunqi.api.closelayer(Yunqi.app.window.id, true);
-                    } else {
-                        this.$message.error(res.msg);
-                        return false;
+                {
+                    field: 'weigh', title: __('价格'), width: 220, formatter: function (data) {
+                        let html = Yunqi.formatter.html;
+                        html.value = `<input class="input" value='' />`;
+                        return html;
                     }
-                });
+                },
 
-            },
 
-            deleteRow(index, rows) {
-                rows.splice(index, 1);
-            }
-        },
-        onLoad: function () {
-            
-            let type = Yunqi.data.fieldList;
-            //全部品种
-            for (var key in Object(type)) {
-                typeList.push({ label: type[key], value: key });
-            }
-            //全部客户
-            let customer = Yunqi.data.customerList;
-            for (var key in Object(customer)) {
-                customerList.push({ label: customer[key], value: key });
+            ],
+            row: Yunqi.data.row,
+            tableData: [
+                {
+                    "name": "哈密",
+                    "num": "3940.00"
+                },
+                {
+                    "name": "紫薯",
+                    "num": "8915.00"
+                }
+            ],
+            value: "",
+            form: {
+                nameValue: null,
+            },
+            options: [],//品种
+        },*/
+        methods: {
+            handleClick(tab, event) {
+                console.log(tab, event);
             }
-            
-        },
+
+        }
     }
 </script>
 <style>
+    .input {
+        border: none;
+        width: 100%;
+        box-shadow: 0 0 0 1px #dcdfe6 inset;
+        line-height: 24px;
+        min-height: 31px;
+        caret-color: #999;
+        box-sizing: border-box;
+        padding: 0 10px;
+        border-radius: 4px;
+    }
+
+    .input:active {
+        border: none !important;
+        border-color: #fff !important;
+
+    }
 
+    .input:focus {
+        outline: none;
+        border: none !important;
+        border-color: #fff !important;
+        border: 1px solid #fff !important;
+    }
+
+    .button {
+        display: flex;
+        align-items: center;
+        justify-content: flex-end;
+        padding-top: 15px;
+    }
 </style>

+ 1 - 1
app/admin/view/user/index/add.html

@@ -17,7 +17,7 @@
                 {field: 'username',title: __('账户'),edit:'text',rules:'required'},
                 {field: 'password',title: __('密码'),edit:'text',rules:'required;length(6~30)'},
                 {field: 'avatar', title: __('头像'),edit:'image'},
-                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管'}},
+                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管', 3:'记账'}},
                 {field: 'remark',title: __('备注'),edit:'textarea'},
                 {field: 'status', title: __('状态'), edit:'switch',searchList: {'normal': __('正常'),'hidden': __('隐藏')}},
             ]

+ 1 - 1
app/admin/view/user/index/edit.html

@@ -26,7 +26,7 @@
                 {field: 'sex', title: __('性别'), edit: 'radio',rules:"required",searchList: {1: __('男'), 2: __('女')}},
                 {field: 'email',title: __('邮箱'),rules:'email',edit:'text'},
                 {field: 'mobile',title: __('手机'),edit:'text',rules:'mobile'},
-                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管'}},
+                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管',3:'记账'}},
                 {field: 'status', title: __('状态'), edit:'switch',searchList: {'normal': __('正常'),'hidden': __('隐藏')}},
             ]
         },

+ 6 - 8
app/admin/view/user/index/index.html

@@ -42,14 +42,12 @@
                 {field: 'email',title: __('邮箱'),operate:'LIKE'},
                 {field: 'mobile',title: __('手机'),operate: '='},
                 {field: 'role', title: __('角色'),sortable: true,operate:'selects', formatter(value, row, index) {
-                    let role = "";
-                    if(value ==0)  return "";
-                    if(value=="1,2") return "录入员-库管";
-                    if (value.indexOf("1") !== -1) {
-                        return "录入员";
-                    } else {
-                        return "库管";
-                    }
+                    var role = "";
+                    console.log(value, "====")
+                    if(value.indexOf("1") > -1)  role =role+"录入员";
+                    if(value.indexOf("2") > -1)  role =role+"-库管";
+                    if(value.indexOf("3") > -1)  role =role+"-记账";
+                    return role;
                 }},
                 {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter:Yunqi.formatter.switch,operate:'select'},
                 {field: 'createtime', title: __('创建时间'), width:160,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},

+ 2 - 2
app/api/controller/User.php

@@ -62,8 +62,8 @@ class User extends Base
         try{
        
             validate(UserValidate::class)->scene('login')->check($data);
-
-            $user = $authService->login($data['username'],$data['password']);
+            $terminal = $this->request->post('terminal/d', 0);
+            $user = $authService->login($data['username'],$data['password'], $terminal);
 
         }catch (ValidateException $e) {
           

+ 4 - 1
app/api/service/auth/ApiAuthService.php

@@ -14,7 +14,7 @@ class ApiAuthService
     protected $allowFields = ['id', 'nickname', 'mobile', 'avatar', 'balance', 'score'];
     
 
-    public function login(string $username, string $password)
+    public function login(string $username, string $password, int $terminal = 0)
     {
         $token=uuid();
         $user=User::where('username',$username)->find();
@@ -27,6 +27,9 @@ class ApiAuthService
         if($user->status!='normal'){
             throw new \Exception('账号已经被禁用');
         }
+        if($terminal==1 && strpos($user->role, "3") === false){
+            throw new \Exception('账号已经被禁用');
+        }
         //刷新token
         $token = MysqlAdapter::login($token, $user);
         $user->loginfailure = 0;

+ 2 - 2
app/common/model/CustomerSpec.php → app/common/model/CustomerSpecBack.php

@@ -5,10 +5,10 @@ namespace app\common\model;
 
 use think\Model;
 
-class CustomerSpec Extends Model
+class CustomerSpecBack Extends Model
 {
 
-
+      //customer_spec spec_back
       //customer
       public function customer()
       {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
runtime/cache/7a/b2b683b6c3e8e0985917962d853b9c.php


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác