licailing 5 éve
szülő
commit
4643f528d8
23 módosított fájl, 808 hozzáadás és 326 törlés
  1. 9 1
      src/main/java/com/izouma/dingdong/domain/OrderGoodsSpec.java
  2. 1 1
      src/main/java/com/izouma/dingdong/domain/User.java
  3. 32 0
      src/main/java/com/izouma/dingdong/domain/backstage/MerchantNature.java
  4. 2 2
      src/main/java/com/izouma/dingdong/domain/merchant/MerchantSettings.java
  5. 3 3
      src/main/java/com/izouma/dingdong/dto/MerchantDTO.java
  6. 4 0
      src/main/java/com/izouma/dingdong/repo/OrderInfoRepo.java
  7. 8 0
      src/main/java/com/izouma/dingdong/repo/backstage/MerchantNatureRepo.java
  8. 39 37
      src/main/java/com/izouma/dingdong/security/WebSecurityConfig.java
  9. 14 0
      src/main/java/com/izouma/dingdong/service/backstage/MerchantNatureService.java
  10. 6 3
      src/main/java/com/izouma/dingdong/service/merchant/MerchantService.java
  11. 7 0
      src/main/java/com/izouma/dingdong/web/OrderGoodsSpecController.java
  12. 7 0
      src/main/java/com/izouma/dingdong/web/OrderInfoController.java
  13. 63 0
      src/main/java/com/izouma/dingdong/web/backstage/MerchantNatureController.java
  14. 1 0
      src/main/resources/genjson/MerchantNature.json
  15. 16 0
      src/main/vue/src/router.js
  16. 88 0
      src/main/vue/src/views/MerchantNatureEdit.vue
  17. 164 0
      src/main/vue/src/views/MerchantNatureList.vue
  18. 67 35
      src/main/vue/src/views/OrderInfoEdit.vue
  19. 118 98
      src/main/vue/src/views/OrderInfoList.vue
  20. 5 10
      src/main/vue/src/views/UserEdit.vue
  21. 2 2
      src/main/vue/src/views/UserList.vue
  22. 130 134
      src/main/vue/src/views/backstage/BlackUserEdit.vue
  23. 22 0
      src/test/java/com/izouma/dingdong/repo/OrderInfoRepoTest.java

+ 9 - 1
src/main/java/com/izouma/dingdong/domain/OrderGoodsSpec.java

@@ -1,11 +1,14 @@
 package com.izouma.dingdong.domain;
 
 
+import com.izouma.dingdong.domain.merchant.Goods;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.*;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
 
-import javax.persistence.Entity;
+import javax.persistence.*;
 import java.io.Serializable;
 import java.math.BigDecimal;
 
@@ -42,4 +45,9 @@ public class OrderGoodsSpec extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "商品折扣价格", name = "goodsRealPrice")
     private BigDecimal goodsRealPrice;
 
+    @OneToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "goodsId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
+    @NotFound(action = NotFoundAction.IGNORE)
+    private Goods goods;
+
 }

+ 1 - 1
src/main/java/com/izouma/dingdong/domain/User.java

@@ -41,7 +41,7 @@ public class User extends BaseEntity implements Serializable {
 
     private String avatar;
 
-    @JsonIgnore
+   // @JsonIgnore
     private String password;
 
     @Column(nullable = false)

+ 32 - 0
src/main/java/com/izouma/dingdong/domain/backstage/MerchantNature.java

@@ -0,0 +1,32 @@
+package com.izouma.dingdong.domain.backstage;
+
+import com.izouma.dingdong.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@Where(clause = "active = 1")
+@ApiModel(value = "商家性质", description = "商家性质")
+public class MerchantNature extends BaseEntity implements Serializable {
+    @Size(max = 30)
+    @Column(length = 30)
+    @ApiModelProperty(value = "名称", name = "name")
+    private String name;
+
+    private Boolean active;
+
+}

+ 2 - 2
src/main/java/com/izouma/dingdong/domain/merchant/MerchantSettings.java

@@ -75,8 +75,8 @@ public class MerchantSettings extends BaseEntity {
     @ApiModelProperty(value = "营业资质", name = "qualification")
     private String qualification;
 
-    @ApiModelProperty(value = "商家性质", name = "businessNature")
-    private String businessNature;
+    @ApiModelProperty(value = "商家性质", name = "merchantNatureId")
+    private Long merchantNatureId;
 
     @Builder.Default
     private Boolean enabled = true;

+ 3 - 3
src/main/java/com/izouma/dingdong/dto/MerchantDTO.java

@@ -28,7 +28,7 @@ public class MerchantDTO {
         aliAccount = merchant.getAliAccount();
         aliName = merchant.getAliName();
         blacklist = merchant.getBlacklist();
-        businessNature = merchantSettings.getBusinessNature();
+        merchantNatureId = merchantSettings.getMerchantNatureId();
         category = merchantSettings.getCategory();
         enabled = merchant.getEnabled();
         endTime = merchantSettings.getEndTime();
@@ -136,8 +136,8 @@ public class MerchantDTO {
     @ApiModelProperty(value = "营业资质", name = "qualification")
     private String qualification;
 
-    @ApiModelProperty(value = "营业性质", name = "businessNature")
-    private String businessNature;
+    @ApiModelProperty(value = "营业性质", name = "merchantNatureId")
+    private Long merchantNatureId;
 
     @ApiModelProperty(value = "通过", name = "isPass")
     private Boolean isPass;

+ 4 - 0
src/main/java/com/izouma/dingdong/repo/OrderInfoRepo.java

@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
 import javax.transaction.Transactional;
+import java.math.BigDecimal;
 import java.util.List;
 
 public interface OrderInfoRepo extends JpaRepository<OrderInfo, Long>, JpaSpecificationExecutor<OrderInfo> {
@@ -27,4 +28,7 @@ public interface OrderInfoRepo extends JpaRepository<OrderInfo, Long>, JpaSpecif
 
     //按商家和用户查找订单,判断是不是第一次购买
     List<OrderInfo> findAllByUserIdAndMerchantId(Long userId,Long merchantId);
+
+    @Query("select sum (t.realAmount) from OrderInfo t where t.userId = ?1")
+    BigDecimal sumRealAmountByUserId(Long userId);
 }

+ 8 - 0
src/main/java/com/izouma/dingdong/repo/backstage/MerchantNatureRepo.java

@@ -0,0 +1,8 @@
+package com.izouma.dingdong.repo.backstage;
+
+import com.izouma.dingdong.domain.backstage.MerchantNature;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface MerchantNatureRepo extends JpaRepository<MerchantNature, Long>, JpaSpecificationExecutor<MerchantNature> {
+}

+ 39 - 37
src/main/java/com/izouma/dingdong/security/WebSecurityConfig.java

@@ -38,7 +38,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Autowired
     public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
         auth.userDetailsService(jwtUserDetailsService)
-            .passwordEncoder(passwordEncoderBean());
+                .passwordEncoder(passwordEncoderBean());
     }
 
     @Bean
@@ -56,29 +56,31 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     protected void configure(HttpSecurity httpSecurity) throws Exception {
         // We don't need CSRF for this example
         httpSecurity.csrf().disable()
-                    .cors().and()
-                    // dont authenticate this particular request
-                    .authorizeRequests()
-                    //swagger-ui放行路径
-                    .antMatchers("/v2/api-docs", "/swagger-ui.html", "/swagger-resources/**", "/webjars/**").permitAll()
-                    .antMatchers("/user/register").permitAll()
-                    .antMatchers("/upload/**").permitAll()
-                    .antMatchers("/static/**").permitAll()
-                    .antMatchers("/auth/**").permitAll()
-                    .antMatchers("/admin/**").permitAll()
-                    .antMatchers("/orderNotify/**").permitAll()
-                    .antMatchers("/order/logistic").permitAll()
-                    .antMatchers("/systemVariable/all").permitAll()
-                    .antMatchers("/**/excel").permitAll()
-                    .antMatchers("/wx/**").permitAll()
-                    .antMatchers("/sms/sendVerify").permitAll()
-                    // all other requests need to be authenticated
-                    .anyRequest().authenticated().and()
-                    // make sure we use stateless session; session won't be used to
-                    // store user's state.
-                    .exceptionHandling().authenticationEntryPoint(unauthorizedHandler)
-                    .and().sessionManagement()
-                    .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
+                .cors().and()
+                // dont authenticate this particular request
+                .authorizeRequests()
+                //swagger-ui放行路径
+                .antMatchers("/v2/api-docs", "/swagger-ui.html", "/swagger-resources/**", "/webjars/**").permitAll()
+                .antMatchers("/category/all").permitAll()
+                .antMatchers("/merchantNature/all").permitAll()
+                .antMatchers("/user/register").permitAll()
+                .antMatchers("/upload/**").permitAll()
+                .antMatchers("/static/**").permitAll()
+                .antMatchers("/auth/**").permitAll()
+                .antMatchers("/admin/**").permitAll()
+                .antMatchers("/orderNotify/**").permitAll()
+                .antMatchers("/order/logistic").permitAll()
+                .antMatchers("/systemVariable/all").permitAll()
+                .antMatchers("/**/excel").permitAll()
+                .antMatchers("/wx/**").permitAll()
+                .antMatchers("/sms/sendVerify").permitAll()
+                // all other requests need to be authenticated
+                .anyRequest().authenticated().and()
+                // make sure we use stateless session; session won't be used to
+                // store user's state.
+                .exceptionHandling().authenticationEntryPoint(unauthorizedHandler)
+                .and().sessionManagement()
+                .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
         // Add a filter to validate the tokens with every request
         httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
     }
@@ -87,19 +89,19 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     public void configure(WebSecurity web) throws Exception {
         // AuthenticationTokenFilter will ignore the below paths
         web.ignoring()
-           .antMatchers("/auth/**")
+                .antMatchers("/auth/**")
 
-           // allow anonymous resource requests
-           .and()
-           .ignoring()
-           .antMatchers(
-                   HttpMethod.GET,
-                   "/",
-                   "/*.html",
-                   "/**/favicon.ico",
-                   "/**/*.html",
-                   "/**/*.css",
-                   "/**/*.js"
-           );
+                // allow anonymous resource requests
+                .and()
+                .ignoring()
+                .antMatchers(
+                        HttpMethod.GET,
+                        "/",
+                        "/*.html",
+                        "/**/favicon.ico",
+                        "/**/*.html",
+                        "/**/*.css",
+                        "/**/*.js"
+                );
     }
 }

+ 14 - 0
src/main/java/com/izouma/dingdong/service/backstage/MerchantNatureService.java

@@ -0,0 +1,14 @@
+package com.izouma.dingdong.service.backstage;
+
+import com.izouma.dingdong.domain.backstage.MerchantNature;
+import com.izouma.dingdong.repo.backstage.MerchantNatureRepo;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class MerchantNatureService {
+
+    private MerchantNatureRepo merchantNatureRepo;
+
+}

+ 6 - 3
src/main/java/com/izouma/dingdong/service/merchant/MerchantService.java

@@ -67,8 +67,12 @@ public class MerchantService {
         }
 
         user.setPassword(new BCryptPasswordEncoder().encode(merchantDTO.getPassword()));
-        user.setAvatar(merchantDTO.getLogo());
-        user.setNickname(merchantDTO.getShowName());
+        if (ObjectUtil.isNotNull(merchantDTO.getLogo())) {
+            user.setAvatar(merchantDTO.getLogo());
+        }
+        if (ObjectUtil.isNotNull(merchantDTO.getShowName())) {
+            user.setNickname(merchantDTO.getShowName());
+        }
         user.setIdentity(Identity.MERCHANT);
         userRepo.save(user);
 
@@ -239,5 +243,4 @@ public class MerchantService {
      */
 
 
-
 }

+ 7 - 0
src/main/java/com/izouma/dingdong/web/OrderGoodsSpecController.java

@@ -6,6 +6,7 @@ import com.izouma.dingdong.exception.BusinessException;
 import com.izouma.dingdong.repo.OrderGoodsSpecRepo;
 import com.izouma.dingdong.utils.ObjUtils;
 import com.izouma.dingdong.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -56,5 +57,11 @@ public class OrderGoodsSpecController extends BaseController {
         List<OrderGoodsSpec> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
     }
+
+    @GetMapping("/byOrder")
+    @ApiOperation("按订单号查出规格")
+    public List<OrderGoodsSpec> byOrder(Long orderId){
+        return orderGoodsSpecRepo.findAllByOrderId(orderId);
+    }
 }
 

+ 7 - 0
src/main/java/com/izouma/dingdong/web/OrderInfoController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.List;
 
 @RestController
@@ -94,5 +95,11 @@ public class OrderInfoController extends BaseController {
     public void riderStatus(Long orderId, Boolean pass) {
         orderInfoService.carryOut(orderId, pass);
     }
+
+    @GetMapping("/allAmount")
+    @ApiOperation("消费金额")
+    public BigDecimal allAmount(Long id) {
+        return orderInfoRepo.sumRealAmountByUserId(id);
+    }
 }
 

+ 63 - 0
src/main/java/com/izouma/dingdong/web/backstage/MerchantNatureController.java

@@ -0,0 +1,63 @@
+package com.izouma.dingdong.web.backstage;
+
+import com.izouma.dingdong.web.BaseController;
+import com.izouma.dingdong.domain.backstage.MerchantNature;
+import com.izouma.dingdong.service.backstage.MerchantNatureService;
+import com.izouma.dingdong.dto.PageQuery;
+import com.izouma.dingdong.exception.BusinessException;
+import com.izouma.dingdong.repo.backstage.MerchantNatureRepo;
+import com.izouma.dingdong.utils.ObjUtils;
+import com.izouma.dingdong.utils.excel.ExcelUtils;
+
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/merchantNature")
+@AllArgsConstructor
+public class MerchantNatureController extends BaseController {
+    private MerchantNatureService merchantNatureService;
+    private MerchantNatureRepo merchantNatureRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public MerchantNature save(@RequestBody MerchantNature record) {
+        if (record.getId() != null) {
+            MerchantNature orig = merchantNatureRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return merchantNatureRepo.save(orig);
+        }
+        return merchantNatureRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @GetMapping("/all")
+    public Page<MerchantNature> all(PageQuery pageQuery) {
+        return merchantNatureRepo.findAll(toSpecification(pageQuery,MerchantNature.class), toPageRequest(pageQuery));
+    }
+
+    @GetMapping("/get/{id}")
+    public MerchantNature get(@PathVariable Long id) {
+        return merchantNatureRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        merchantNatureRepo.deleteById(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<MerchantNature> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+}
+

+ 1 - 0
src/main/resources/genjson/MerchantNature.json

@@ -0,0 +1 @@
+{"tableName":"MerchantNature","className":"MerchantNature","remark":"商家性质","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/qiufangchao/Desktop/project/dingdong/src/main/java/com/izouma/dingdong","viewPath":"/Users/qiufangchao/Desktop/project/dingdong/src/main/vue/src/views","routerPath":"/Users/qiufangchao/Desktop/project/dingdong/src/main/vue/src","resourcesPath":"/Users/qiufangchao/Desktop/project/dingdong/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"name","modelName":"name","remark":"名称","showInList":true,"showInForm":true,"formType":"singleLineText"}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.dingdong","tablePackage":"com.izouma.dingdong.domain.backstage.MerchantNature","genPackage":"backstage"}

+ 16 - 0
src/main/vue/src/router.js

@@ -270,6 +270,22 @@ const router = new Router({
                     meta: {
                        title: '购物车',
                     },
+               },
+                {
+                    path: '/merchantNatureEdit',
+                    name: 'MerchantNatureEdit',
+                    component: () => import(/* webpackChunkName: "merchantNatureEdit" */ '@/views/MerchantNatureEdit.vue'),
+                    meta: {
+                       title: '商家性质编辑',
+                    },
+                },
+                {
+                    path: '/merchantNatureList',
+                    name: 'MerchantNatureList',
+                    component: () => import(/* webpackChunkName: "merchantNatureList" */ '@/views/MerchantNatureList.vue'),
+                    meta: {
+                       title: '商家性质',
+                    },
                }
                 /**INSERT_LOCATION**/,
                 {

+ 88 - 0
src/main/vue/src/views/MerchantNatureEdit.vue

@@ -0,0 +1,88 @@
+<template>
+    <div class="edit-view">
+        <el-form :model="formData" :rules="rules" ref="form" label-width="52px" label-position="right" size="small"
+                 style="max-width: 500px;">
+                <el-form-item prop="name" label="名称">
+                            <el-input v-model="formData.name"></el-input>
+                </el-form-item>
+            <el-form-item>
+                <el-button @click="onSave" :loading="saving"
+                           type="primary">保存</el-button>
+                <el-button @click="onDelete" :loading="saving"
+                           type="danger" v-if="formData.id">删除
+                </el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div>
+</template>
+<script>
+    export default {
+        name: 'MerchantNatureEdit',
+        created() {
+            if (this.$route.query.id) {
+                this.$http
+                    .get('merchantNature/get/'+this.$route.query.id)
+                    .then(res => {
+                        this.formData = res;
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    });
+            }
+        },
+        data() {
+            return {
+                saving: false,
+                formData: {
+                },
+                rules: {
+                },
+            }
+        },
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                let data = {...this.formData};
+
+                this.saving = true;
+                this.$http
+                    .post('/merchantNature/save', data, {body: 'json'})
+                    .then(res => {
+                        this.saving = false;
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.saving = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            onDelete() {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/merchantNature/del/${this.formData.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 164 - 0
src/main/vue/src/views/MerchantNatureList.vue

@@ -0,0 +1,164 @@
+<template>
+    <div  class="list-view">
+        <div class="filters-container">
+            <el-input placeholder="输入关键字" v-model="search" clearable
+                      class="filter-item"></el-input>
+            <el-button @click="getData" type="primary" icon="el-icon-search"
+                       class="filter-item">搜索
+            </el-button>
+            <el-button @click="addRow" type="primary" icon="el-icon-plus"
+                       class="filter-item">添加
+            </el-button>
+            <el-button @click="download" type="primary" icon="el-icon-download"
+                       :loading="downloading" class="filter-item">导出EXCEL
+            </el-button>
+        </div>
+        <el-table :data="tableData" row-key="id" ref="table"
+                  header-row-class-name="table-header-row"
+                  header-cell-class-name="table-header-cell"
+                  row-class-name="table-row" cell-class-name="table-cell"
+                  :height="tableHeight">
+            <el-table-column v-if="multipleMode" align="center" type="selection"
+                             width="50">
+            </el-table-column>
+            <el-table-column prop="id" label="ID" width="100">
+            </el-table-column>
+                                <el-table-column prop="name" label="名称"
+>
+                    </el-table-column>
+            <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right"
+                    min-width="150">
+                <template slot-scope="{row}">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination background @size-change="onSizeChange"
+                           @current-change="onCurrentChange" :current-page="page"
+                           :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize"
+                           layout="total, sizes, prev, pager, next, jumper"
+                           :total="totalElements">
+            </el-pagination>
+        </div>
+
+    </div>
+</template>
+<script>
+    import { mapState } from "vuex";
+    import pageableTable from "@/mixins/pageableTable";
+
+    export default {
+        name: 'MerchantNatureList',
+        mixins: [pageableTable],
+        created() {
+            this.getData();
+        },
+        data() {
+            return {
+                multipleMode: false,
+                search: "",
+                url: "/merchantNature/all",
+                downloading: false,
+            }
+        },
+        computed: {
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            beforeGetData() {
+                if (this.search) {
+                    return { search: this.search };
+                }
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            addRow() {
+                this.$router.push({
+                    path: "/merchantNatureEdit",
+                    query: {
+                    ...this.$route.query
+                    }
+                });
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: "/merchantNatureEdit",
+                    query: {
+                    id: row.id
+                    }
+                });
+            },
+            download() {
+                this.downloading = true;
+                this.$axios
+                    .get("/merchantNature/excel", { 
+                        responseType: "blob",
+                        params: { size: 10000 }
+                    })
+                    .then(res => {
+                        console.log(res);
+                        this.downloading = false;
+                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                        const link = document.createElement("a");
+                        link.href = downloadUrl;
+                        link.setAttribute(
+                            "download",
+                            res.headers["content-disposition"].split("filename=")[1]
+                        );
+                        document.body.appendChild(link);
+                        link.click();
+                        link.remove();
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.downloading = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            },
+            deleteRow(row) {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/merchantNature/del/${row.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                }).catch(action => {
+                    if (action === 'cancel') {
+                        this.$message.info('删除取消');
+                    } else {
+                        this.$message.error('删除失败');
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 67 - 35
src/main/vue/src/views/OrderInfoEdit.vue

@@ -11,15 +11,12 @@
             <el-form-item prop="merchantId" label="商户ID">
                 <el-input-number type="number" v-model="formData.merchantId"></el-input-number>
             </el-form-item>
-            <el-form-item prop="goodsId" label="商品ID">
-                <el-input-number type="number" v-model="formData.goodsId"></el-input-number>
-            </el-form-item>
             <el-form-item prop="merchantStatus" label="商家状态">
                 <el-input v-model="formData.merchantStatus"></el-input>
             </el-form-item>
-            <el-form-item prop="merchantAddress" label="商家地址">
-                <el-input v-model="formData.merchantAddress"></el-input>
-            </el-form-item>
+            <!--            <el-form-item prop="merchantAddress" label="商家地址">-->
+            <!--                <el-input v-model="formData.merchantAddress"></el-input>-->
+            <!--            </el-form-item>-->
             <el-form-item prop="jobNumber" label="骑手工号">
                 <el-input v-model="formData.jobNumber"></el-input>
             </el-form-item>
@@ -36,9 +33,9 @@
             <el-form-item prop="totalAmount" label="总价">
                 <el-input-number type="number" v-model="formData.totalAmount"></el-input-number>
             </el-form-item>
-            <el-form-item prop="goodsAmount" label="商品总价">
-                <el-input-number type="number" v-model="formData.goodsAmount"></el-input-number>
-            </el-form-item>
+            <!--            <el-form-item prop="goodsAmount" label="商品总价">-->
+            <!--                <el-input-number type="number" v-model="formData.goodsAmount"></el-input-number>-->
+            <!--            </el-form-item>-->
             <el-form-item prop="deliveryAmount" label="配送费">
                 <el-input-number type="number" v-model="formData.deliveryAmount"></el-input-number>
             </el-form-item>
@@ -69,22 +66,22 @@
                         placeholder="选择日期时间">
                 </el-date-picker>
             </el-form-item>
-<!--            <el-form-item prop="merchantOrderTime" label="商家接单时间">-->
-<!--                <el-date-picker-->
-<!--                        v-model="formData.merchantOrderTime"-->
-<!--                        type="datetime"-->
-<!--                        value-format="yyyy-MM-dd HH:mm:ss"-->
-<!--                        placeholder="选择日期时间">-->
-<!--                </el-date-picker>-->
-<!--            </el-form-item>-->
-<!--            <el-form-item prop="riderOrderTime" label="骑手接单时间">-->
-<!--                <el-date-picker-->
-<!--                        v-model="formData.riderOrderTime"-->
-<!--                        type="datetime"-->
-<!--                        value-format="yyyy-MM-dd HH:mm:ss"-->
-<!--                        placeholder="选择日期时间">-->
-<!--                </el-date-picker>-->
-<!--            </el-form-item>-->
+            <!--            <el-form-item prop="merchantOrderTime" label="商家接单时间">-->
+            <!--                <el-date-picker-->
+            <!--                        v-model="formData.merchantOrderTime"-->
+            <!--                        type="datetime"-->
+            <!--                        value-format="yyyy-MM-dd HH:mm:ss"-->
+            <!--                        placeholder="选择日期时间">-->
+            <!--                </el-date-picker>-->
+            <!--            </el-form-item>-->
+            <!--            <el-form-item prop="riderOrderTime" label="骑手接单时间">-->
+            <!--                <el-date-picker-->
+            <!--                        v-model="formData.riderOrderTime"-->
+            <!--                        type="datetime"-->
+            <!--                        value-format="yyyy-MM-dd HH:mm:ss"-->
+            <!--                        placeholder="选择日期时间">-->
+            <!--                </el-date-picker>-->
+            <!--            </el-form-item>-->
             <el-form-item prop="userReceivedTime" label="用户收到时间">
                 <el-date-picker
                         v-model="formData.userReceivedTime"
@@ -93,9 +90,27 @@
                         placeholder="选择日期时间">
                 </el-date-picker>
             </el-form-item>
-            <el-form-item prop="isCoupon" label="使用优惠券">
-                <el-switch v-model="formData.isCoupon"></el-switch>
+            <!--            <el-form-item prop="isCoupon" label="使用优惠券">-->
+            <!--                <el-switch v-model="formData.isCoupon"></el-switch>-->
+            <!--            </el-form-item>-->
+            <el-form-item prop="goods" label="商品详情">
+                <template v-if="goods">
+                    <el-table :data="goods">
+                        <el-table-column prop="goodsId" label="商品ID">
+                        </el-table-column>
+                        <el-table-column prop="goods.name" label="商品名称"></el-table-column>
+                        <el-table-column prop="num" label="数量">
+                        </el-table-column>
+                        <el-table-column prop="specification" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="goodsPrice" label="价格">
+                        </el-table-column>
+
+                    </el-table>
+                </template>
+
             </el-form-item>
+
             <el-form-item>
                 <el-button @click="onSave" :loading="saving"
                            type="primary">保存
@@ -105,6 +120,8 @@
                 </el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
             </el-form-item>
+
+
         </el-form>
     </div>
 </template>
@@ -122,6 +139,19 @@
                         console.log(e);
                         this.$message.error(e.error);
                     });
+
+                this.$http
+                    .get('/orderGoodsSpec/byOrder',
+                        {
+                            orderId: this.$route.query.id
+                        }
+                    )
+                    .then(res => {
+                        this.goods = res;
+                    })
+                    .catch(e => {
+                        console.log(e);
+                    });
             }
         },
         data() {
@@ -129,14 +159,16 @@
                 saving: false,
                 formData: {},
                 rules: {},
-                riderStatusOptions: [{"label": "接单", "value": "RECEIVED"}, {
-                    "label": "取餐",
-                    "value": "TAKE_MEAL"
-                }, {"label": "送餐", "value": "MEAL_DELIVERY"}, {"label": "完成", "value": "CARRY_OUT"}],
-                payMethodOptions: [{"label": "支付宝", "value": "ALI_PAY"}, {
-                    "label": "货到付款",
-                    "value": "CASH_DELIVERY"
-                }, {"label": "信用卡", "value": "CREDIT_CARD"}],
+                riderStatusOptions: [
+                    {"label": "接单", "value": "RECEIVED"},
+                    {"label": "取餐", "value": "TAKE_MEAL"},
+                    {"label": "送餐", "value": "MEAL_DELIVERY"},
+                    {"label": "完成", "value": "CARRY_OUT"}],
+                payMethodOptions: [
+                    {"label": "支付宝", "value": "ALI_PAY"},
+                    {"label": "货到付款", "value": "CASH_DELIVERY"},
+                    {"label": "信用卡", "value": "CREDIT_CARD"}],
+                goods: [],
             }
         },
         methods: {

+ 118 - 98
src/main/vue/src/views/OrderInfoList.vue

@@ -1,14 +1,14 @@
 <template>
-    <div  class="list-view">
+    <div class="list-view">
         <div class="filters-container">
             <el-input placeholder="输入关键字" v-model="search" clearable
                       class="filter-item"></el-input>
             <el-button @click="getData" type="primary" icon="el-icon-search"
                        class="filter-item">搜索
             </el-button>
-            <el-button @click="addRow" type="primary" icon="el-icon-plus"
-                       class="filter-item">添加
-            </el-button>
+            <!--            <el-button @click="addRow" type="primary" icon="el-icon-plus"
+                                   class="filter-item">添加
+                        </el-button>-->
             <el-button @click="download" type="primary" icon="el-icon-download"
                        :loading="downloading" class="filter-item">导出EXCEL
             </el-button>
@@ -23,72 +23,73 @@
             </el-table-column>
             <el-table-column prop="id" label="ID" width="100">
             </el-table-column>
-                                <el-table-column prop="userId" label="用户ID"
->
-                    </el-table-column>
-                    <el-table-column prop="userAddress" label="配送地址"
->
-                    </el-table-column>
-                    <el-table-column prop="merchantId" label="商户ID"
->
-                    </el-table-column>
-                    <el-table-column prop="merchantStatus" label="商家状态"
->
-                    </el-table-column>
-                    <el-table-column prop="jobNumber" label="骑手工号"
->
-                    </el-table-column>
-                    <el-table-column prop="riderStatus" label="骑手状态"
-                            :formatter="riderStatusFormatter"
-                        >
-                    </el-table-column>
-                    <el-table-column prop="goodsAmount" label="商品总价"
->
-                    </el-table-column>
-                    <el-table-column prop="deliveryAmount" label="配送费"
->
-                    </el-table-column>
-                    <el-table-column prop="realAmount" label="实付金额"
->
-                    </el-table-column>
-                    <el-table-column prop="payMethod" label="支付方式"
-                            :formatter="payMethodFormatter"
-                        >
-                    </el-table-column>
-                    <el-table-column prop="cancel" label="取消订单"
->
-                            <template slot-scope="{row}">
-                                <el-tag :type="row.cancel?'':'info'">{{row.cancel}}</el-tag>
-                            </template>
-                    </el-table-column>
-                    <el-table-column prop="rated" label="已评价"
->
-                            <template slot-scope="{row}">
-                                <el-tag :type="row.rated?'':'info'">{{row.rated}}</el-tag>
-                            </template>
-                    </el-table-column>
-                    <el-table-column prop="orderTime" label="下单时间"
-                            :formatter="datetimeFormatter"
->
-                    </el-table-column>
-<!--                    <el-table-column prop="merchantOrderTime" label="商家接单时间"
-                            :formatter="datetimeFormatter"
->
-                    </el-table-column>
-                    <el-table-column prop="riderOrderTime" label="骑手接单时间"
-                            :formatter="datetimeFormatter"
->
-                    </el-table-column> -->
-                    <el-table-column prop="userReceivedTime" label="用户收到时间"
-                            :formatter="datetimeFormatter"
->
-                    </el-table-column>
-<!--                    <el-table-column prop="isCoupon" label="使用优惠券"
->
-                            <template slot-scope="{row}">
-                                <el-tag :type="row.isCoupon?'false':'info'">{{row.isCoupon}}</el-tag>
-                            </template>
-                    </el-table-column>-->
+            <el-table-column prop="userId" label="用户ID"
+            >
+            </el-table-column>
+            <el-table-column prop="userAddress" label="配送地址"
+            >
+            </el-table-column>
+            <el-table-column prop="merchantId" label="商户ID"
+            >
+            </el-table-column>
+            <el-table-column prop="merchantStatus" label="商家状态"
+                             :formatter="merchantStatusFormatter"
+            >
+            </el-table-column>
+            <el-table-column prop="jobNumber" label="骑手工号"
+            >
+            </el-table-column>
+            <el-table-column prop="riderStatus" label="骑手状态"
+                             :formatter="riderStatusFormatter"
+            >
+            </el-table-column>
+<!--            <el-table-column prop="goodsAmount" label="商品总价"-->
+<!--            >-->
+<!--            </el-table-column>-->
+            <el-table-column prop="deliveryAmount" label="配送费"
+            >
+            </el-table-column>
+            <el-table-column prop="realAmount" label="实付金额"
+            >
+            </el-table-column>
+            <el-table-column prop="payMethod" label="支付方式"
+                             :formatter="payMethodFormatter"
+            >
+            </el-table-column>
+            <el-table-column prop="cancel" label="取消订单"
+            >
+                <template slot-scope="{row}">
+                    <el-tag :type="row.cancel?'':'info'">{{row.cancel}}</el-tag>
+                </template>
+            </el-table-column>
+            <el-table-column prop="rated" label="已评价"
+            >
+                <template slot-scope="{row}">
+                    <el-tag :type="row.rated?'':'info'">{{row.rated}}</el-tag>
+                </template>
+            </el-table-column>
+            <el-table-column prop="orderTime" label="下单时间"
+                             :formatter="datetimeFormatter"
+            >
+            </el-table-column>
+            <!--                    <el-table-column prop="merchantOrderTime" label="商家接单时间"
+                                        :formatter="datetimeFormatter"
+            >
+                                </el-table-column>
+                                <el-table-column prop="riderOrderTime" label="骑手接单时间"
+                                        :formatter="datetimeFormatter"
+            >
+                                </el-table-column> -->
+            <el-table-column prop="userReceivedTime" label="用户收到时间"
+                             :formatter="datetimeFormatter"
+            >
+            </el-table-column>
+            <!--                    <el-table-column prop="isCoupon" label="使用优惠券"
+            >
+                                        <template slot-scope="{row}">
+                                            <el-tag :type="row.isCoupon?'false':'info'">{{row.isCoupon}}</el-tag>
+                                        </template>
+                                </el-table-column>-->
             <el-table-column
                     label="操作"
                     align="center"
@@ -121,7 +122,7 @@
     </div>
 </template>
 <script>
-    import { mapState } from "vuex";
+    import {mapState} from "vuex";
     import pageableTable from "@/mixins/pageableTable";
 
     export default {
@@ -136,8 +137,20 @@
                 search: "",
                 url: "/orderInfo/all",
                 downloading: false,
-                        riderStatusOptions:[{"label":"接单","value":"RECEIVED"},{"label":"取餐","value":"TAKE_MEAL"},{"label":"送餐","value":"MEAL_DELIVERY"},{"label":"完成","value":"CARRY_OUT"}],
-                        payMethodOptions:[{"label":"支付宝","value":"ALI_PAY"},{"label":"货到付款","value":"CASH_DELIVERY"},{"label":"信用卡","value":"CREDIT_CARD"}],
+                merchantStatusOptions:[{"label": "接单", "value": "RECEIVED"}, {
+                    "label": "未接单",
+                    "value": "NOT_RECEIVED"
+                }, {"label": "已拒单", "value": "REJECTED"}],
+
+                riderStatusOptions: [{"label": "接单", "value": "RECEIVED"}, {
+                    "label": "取餐",
+                    "value": "TAKE_MEAL"
+                }, {"label": "送餐", "value": "MEAL_DELIVERY"}, {"label": "完成", "value": "CARRY_OUT"}],
+
+                payMethodOptions: [{"label": "支付宝", "value": "ALI_PAY"}, {
+                    "label": "货到付款",
+                    "value": "CASH_DELIVERY"
+                }, {"label": "信用卡", "value": "CREDIT_CARD"}],
             }
         },
         computed: {
@@ -146,23 +159,30 @@
             }
         },
         methods: {
-                    riderStatusFormatter(row, column, cellValue, index) {
-                        let selectedOption = this.riderStatusOptions.find(i => i.value === cellValue);
-                        if (selectedOption) {
-                            return selectedOption.label;
-                        }
-                        return '';
-                    },
-                    payMethodFormatter(row, column, cellValue, index) {
-                        let selectedOption = this.payMethodOptions.find(i => i.value === cellValue);
-                        if (selectedOption) {
-                            return selectedOption.label;
-                        }
-                        return '';
-                    },
+            merchantStatusFormatter(row, column, cellValue, index) {
+                let selectedOption = this.merchantStatusOptions.find(i => i.value === cellValue);
+                if (selectedOption) {
+                    return selectedOption.label;
+                }
+                return '';
+            },
+            riderStatusFormatter(row, column, cellValue, index) {
+                let selectedOption = this.riderStatusOptions.find(i => i.value === cellValue);
+                if (selectedOption) {
+                    return selectedOption.label;
+                }
+                return '';
+            },
+            payMethodFormatter(row, column, cellValue, index) {
+                let selectedOption = this.payMethodOptions.find(i => i.value === cellValue);
+                if (selectedOption) {
+                    return selectedOption.label;
+                }
+                return '';
+            },
             beforeGetData() {
                 if (this.search) {
-                    return { search: this.search };
+                    return {search: this.search};
                 }
             },
             toggleMultipleMode(multipleMode) {
@@ -179,20 +199,20 @@
             //         }
             //     });
             // },
-            // editRow(row) {
-            //     this.$router.push({
-            //         path: "/orderInfoEdit",
-            //         query: {
-            //         id: row.id
-            //         }
-            //     });
-            // },
+            editRow(row) {
+                this.$router.push({
+                    path: "/orderInfoEdit",
+                    query: {
+                    id: row.id
+                    }
+                });
+            },
             download() {
                 this.downloading = true;
                 this.$axios
-                    .get("/orderInfo/excel", { 
+                    .get("/orderInfo/excel", {
                         responseType: "blob",
-                        params: { size: 10000 }
+                        params: {size: 10000}
                     })
                     .then(res => {
                         console.log(res);

+ 5 - 10
src/main/vue/src/views/UserEdit.vue

@@ -35,7 +35,7 @@
                 <!--             <el-button @click="del" :loading="$store.state.fetchingData"
                                       type="danger" v-if="formData.id">删除
                            </el-button>-->
-                <el-button @click="showSetLogistics=true" :loading="$store.state.fetchingData"
+                <el-button @click="showSetLogistics=true"
                            type="danger" v-if="formData.id">移入黑名单
                 </el-button>
                 <el-button @click="" :loading="$store.state.fetchingData"
@@ -59,7 +59,7 @@
                     ></el-input>
                 </el-form-item>
                 <el-form-item>
-                    <el-button type="primary" @click="move">确认</el-button>
+                    <el-button type="primary" @click="move" size="mini">确认</el-button>
                 </el-form-item>
             </el-form>
         </el-dialog>
@@ -94,6 +94,7 @@
                 formData: {
                     avatar:
                         'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg',
+                    identity: 'USER',
                 },
                 rules: {
                     avatar: [
@@ -141,13 +142,7 @@
             },
             submit() {
                 this.$http
-                    .post({
-                        url: '/user/save',
-                        data: {
-                            identity: 'USER'
-                        }
-
-                    }, this.formData, {body: 'json'})
+                    .post('/user/save', this.formData, { body: 'json' })
                     .then(res => {
                         this.$message.success('成功');
                         this.formData = res;
@@ -226,7 +221,7 @@
             resetPassword() {
                 this.$prompt('请输入新密码', '重置密码', {inputType: 'password'})
                     .then(res => {
-                        console.log(res);
+                        // console.log(res);
                         if (res.value) {
                             this.$alert('确定重置密码?', '提示', {
                                 showCancelButton: true

+ 2 - 2
src/main/vue/src/views/UserList.vue

@@ -113,12 +113,12 @@ export default {
             });
         },
         orderRow(row) {
-            this.$router.push({
+            /*this.$router.push({
                 path: "/orderInfoList",
                 query: {
                     id: row.id
                 }
-            });
+            });*/
         },
         download() {
             this.downloading = true;

+ 130 - 134
src/main/vue/src/views/backstage/BlackUserEdit.vue

@@ -29,17 +29,10 @@
                     </el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item prop="identity" label="身份">
-                <el-select v-model="formData.identity"
-                           placeholder="请选择" >
-                    <el-option key="ADMIN"
-                               label="ADMIN" value="ADMIN">
-                    </el-option>
-                </el-select>
-            </el-form-item>
             <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData"
-                           type="primary">保存</el-button>
+                           type="primary">保存
+                </el-button>
                 <el-button @click="del" :loading="$store.state.fetchingData"
                            type="danger" v-if="formData.id">删除
                 </el-button>
@@ -49,145 +42,148 @@
     </div>
 </template>
 <script>
-export default {
-    created() {
-        if (this.$route.query.id) {
+    export default {
+        created() {
+            if (this.$route.query.id) {
+                this.$http
+                    .get(`/user/get/${this.$route.query.id}`)
+                    .then(res => {
+                        this.formData = res;
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    });
+            }
             this.$http
-                .get(`/user/get/${this.$route.query.id}`)
+                .get('/authority/allAdmin')
                 .then(res => {
-                    this.formData = res;
+                    this.authorities = res;
                 })
                 .catch(e => {
                     console.log(e);
-                    this.$message.error(e.error);
                 });
-        }
-        this.$http
-            .get('/authority/allAdmin')
-            .then(res => {
-                this.authorities = res;
-            })
-            .catch(e => {
-                console.log(e);
-            });
-    },
-    data() {
-        return {
-            saving: false,
-            formData: {
-                avatar:
-                    'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg',
-            },
-            rules: {
-                avatar: [
-                    {
-                        required: true,
-                        regexp: /^[_.@A-Za-z0-9-]*$/,
-                        message: '请上传头像',
-                        trigger: 'blur',
-                    },
-                ],
-                username: [
-                    { required: true, message: '请输入昵称', trigger: 'blur' },
-                ],
-                nickname: [
-                    { required: true, message: '请输入昵称', trigger: 'blur' },
-                ],
-                password: [
-                    { required: true, message: '请输入密码', trigger: 'blur' },
-                ],
-                phone: [
-                    {
-                        regexp: /^1[3-9]\d{9}$/,
-                        message: '请输入正确的手机号',
-                        trigger: 'blur',
-                    },
-                ],
-                authorities: [
-                    { required: true, message: '请选择角色', trigger: 'blur' },
-                ],
-                identity: [
-                    { required: true, message: '请选择身份', trigger: 'blur' },
-                ],
-            },
-            authorities: [],
-            identity:[],
-        };
-    },
-    methods: {
-        onSave() {
-            this.$refs.form.validate(valid => {
-                if (valid) {
-                    this.submit();
-                } else {
-                    return false;
-                }
-            });
         },
-        submit() {
-            this.$http
-                .post('/user/save', this.formData, { body: 'json' })
-                .then(res => {
-                    this.$message.success('成功');
-                    this.formData = res;
-                    this.$router.replace({
-                        query: {
-                            id: res.id
+        data() {
+            return {
+                saving: false,
+                formData: {
+                    avatar:
+                        'https://zhumj.oss-cn-hangzhou.aliyuncs.com/image/user.jpg',
+                    identity: 'ADMIN',
+                },
+                rules: {
+                    avatar: [
+                        {
+                            required: true,
+                            regexp: /^[_.@A-Za-z0-9-]*$/,
+                            message: '请上传头像',
+                            trigger: 'blur',
                         },
-                    });
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
+                    ],
+                    username: [
+                        {required: true, message: '请输入昵称', trigger: 'blur'},
+                    ],
+                    nickname: [
+                        {required: true, message: '请输入昵称', trigger: 'blur'},
+                    ],
+                    password: [
+                        {required: true, message: '请输入密码', trigger: 'blur'},
+                    ],
+                    phone: [
+                        {
+                            regexp: /^1[3-9]\d{9}$/,
+                            message: '请输入正确的手机号',
+                            trigger: 'blur',
+                        },
+                    ],
+                    authorities: [
+                        {required: true, message: '请选择角色', trigger: 'blur'},
+                    ],
+                    identity: [
+                        {required: true, message: '请选择身份', trigger: 'blur'},
+                    ],
+                },
+                authorities: [],
+                identity: [],
+            };
         },
-        del() {
-            this.$confirm('确认删除吗?', '提示', { type: 'warning' })
-                .then(() => {
-                    return this.$http
-                        .post({
-                            url: '/userInfo/del',
-                            data: {
-                                id: this.formData.id,
+        methods: {
+            onSave() {
+                this.$refs.form.validate(valid => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                this.$http
+                    .post('/user/save', this.formData, {body: 'json'})
+                    .then(res => {
+                        this.$message.success('成功');
+                        this.formData = res;
+                        this.$router.replace({
+                            query: {
+                                id: res.id
                             },
-                        })
-                        .then(res => {
-                            if (res.success) {
-                                this.$message.success('成功');
-                                this.$router.go(-1);
-                            } else {
-                                this.$message.warning('失败');
-                            }
                         });
-                })
-                .catch(() => {});
-        },
-        resetPassword() {
-            this.$prompt('请输入新密码', '重置密码', { inputType: 'password' })
-                .then(res => {
-                    console.log(res);
-                    if (res.value) {
-                        this.$alert('确定重置密码?', '提示', {
-                            showCancelButton: true
-                        })
-                            .then(() => {
-                                return this.$http.post('/user/setPasswordAdmin', {
-                                    userId: this.formData.id,
-                                    password: res.value
-                                });
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.$message.error(e.error);
+                    });
+            },
+            del() {
+                this.$confirm('确认删除吗?', '提示', {type: 'warning'})
+                    .then(() => {
+                        return this.$http
+                            .post({
+                                url: '/userInfo/del',
+                                data: {
+                                    id: this.formData.id,
+                                },
                             })
                             .then(res => {
-                                this.$message.success('密码重置成功');
-                            })
-                            .catch(() => {
-                                this.$message.error(res.error || '重置密码失败');
+                                if (res.success) {
+                                    this.$message.success('成功');
+                                    this.$router.go(-1);
+                                } else {
+                                    this.$message.warning('失败');
+                                }
                             });
-                    }
-                })
-                .catch(() => {});
-        }
-    },
-};
+                    })
+                    .catch(() => {
+                    });
+            },
+            resetPassword() {
+                this.$prompt('请输入新密码', '重置密码', {inputType: 'password'})
+                    .then(res => {
+                        console.log(res);
+                        if (res.value) {
+                            this.$alert('确定重置密码?', '提示', {
+                                showCancelButton: true
+                            })
+                                .then(() => {
+                                    return this.$http.post('/user/setPasswordAdmin', {
+                                        userId: this.formData.id,
+                                        password: res.value
+                                    });
+                                })
+                                .then(res => {
+                                    this.$message.success('密码重置成功');
+                                })
+                                .catch(() => {
+                                    this.$message.error(res.error || '重置密码失败');
+                                });
+                        }
+                    })
+                    .catch(() => {
+                    });
+            }
+        },
+    };
 </script>
 <style lang="less" scoped>
 </style>

+ 22 - 0
src/test/java/com/izouma/dingdong/repo/OrderInfoRepoTest.java

@@ -0,0 +1,22 @@
+package com.izouma.dingdong.repo;
+
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class OrderInfoRepoTest {
+    @Autowired
+    private OrderInfoRepo orderInfoRepo;
+
+    @Test
+    public void testOrder() {
+        System.out.println(orderInfoRepo.sumRealAmountByUserId(170l));
+    }
+
+}