zhc4dev
wangjiadong 2 years ago
parent fdf877fd4b
commit b0abb05cae
  1. 62
      ant-design-vue-jeecg/src/views/customershoppingcart/admin/CustomerShoppingCartList.vue
  2. 72
      ant-design-vue-jeecg/src/views/customershoppingcart/admin/modules/CustomerShoppingCartForm.vue
  3. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customershoppingcart/controller/CustomerShoppingCartController.java
  4. 103
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customershoppingcart/entity/CustomerShoppingCart.java

@ -88,22 +88,26 @@
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <!--<a @click="handleEdit(record)">编辑</a>-->
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-dropdown> <!-- <a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay"> <a-menu-item>-->
<a-menu-item> <a @click="handleDetail(record)">购买</a>
<a-divider type="vertical" />
<a @click="handleDetail(record)">详情</a> <a @click="handleDetail(record)">详情</a>
</a-menu-item> <a-divider type="vertical" />
<a-menu-item> <a @click="spxq(record)">商品详情</a>
<a-divider type="vertical" />
<!-- </a-menu-item>
<a-menu-item>-->
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item> <!--</a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>-->
</span> </span>
</a-table> </a-table>
@ -114,13 +118,14 @@
</div> </div>
<!-- <zy-goods-form ref="ZyGoodsForm" @ok="modalFormOk"></zy-goods-form>-->
<customer-shopping-cart-modal ref="modalForm" @ok="modalFormOk"></customer-shopping-cart-modal> <customer-shopping-cart-modal ref="modalForm" @ok="modalFormOk"></customer-shopping-cart-modal>
</a-card> </a-card>
</template> </template>
<script> <script>
import ZyGoodsForm from './modules/ZyGoodsForm'
import '@/assets/less/TableExpand.less' import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin' import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
@ -132,7 +137,8 @@
name: 'CustomerShoppingCartList', name: 'CustomerShoppingCartList',
mixins:[JeecgListMixin, mixinDevice], mixins:[JeecgListMixin, mixinDevice],
components: { components: {
CustomerShoppingCartModal CustomerShoppingCartModal,
ZyGoodsForm
}, },
data () { data () {
return { return {
@ -163,14 +169,25 @@
dataIndex: 'createTime' dataIndex: 'createTime'
}, },
{ {
title:'用户', title:'商品',
align:"center", align:"center",
dataIndex: 'userId_dictText' dataIndex: 'goodsId_dictText'
}, },
{ {
title:'商品', title:'商品',
align:"center", align:"center",
dataIndex: 'goodsId_dictText' dataIndex: 'goodsname'
},
/*{
title:'图片',
align:"center",
dataIndex: 'goodimg',
scopedSlots: {customRender: 'imgSlot'}
},*/
{
title:'款式',
align:"center",
dataIndex: 'styleId_dictText'
}, },
{ {
title:'当前单价', title:'当前单价',
@ -182,6 +199,16 @@
align:"center", align:"center",
dataIndex: 'number' dataIndex: 'number'
}, },
{
title:'发货地址',
align:"center",
dataIndex: 'placeorigin'
},
{
title:'总价',
align:"center",
dataIndex: 'zj'
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
@ -212,6 +239,12 @@
}, },
}, },
methods: { methods: {
spxq(record){
this.$ref.ZyGoodsForm.edit(record);
this.$ref.ZyGoodsForm.title = "测试页面";
this.$ref.ZyGoodsForm.disableSubmit = false;
},
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
}, },
@ -230,9 +263,6 @@
} }
} }
}, },
initDictConfig(){ initDictConfig(){
}, },

@ -3,22 +3,22 @@
<j-form-container :disabled="formDisabled"> <j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row> <a-row>
<a-col :span="24">
<a-form-model-item label="图片字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temiimg">
<j-image-upload isMultiple v-model="model.temiimg" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime"> <a-form-model-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime">
<j-date placeholder="请选择创建日期" v-model="model.createTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled/> <j-date placeholder="请选择创建日期" v-model="model.createTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> <a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="username">
<j-select-user-by-dep v-model="model.userId" /> <j-popup
v-model="model.username"
field="username"
org-fields="id,realname"
dest-fields="userId,username"
code="findcust"
:multi="true"
@input="popupCallback"
/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
@ -27,41 +27,53 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="当前单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price"> <a-form-model-item label="商品" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="goodsname">
<a-input-number v-model="model.price" placeholder="请输入当前单价" style="width: 100%" /> <j-popup
v-model="model.goodsname"
field="goodsname"
org-fields="id,goods_name,style_id,unit_price,place_origin,default_picture"
dest-fields="goodsId,goodsname,styleId,price,placeorigin,goodimg"
code="findgoods2"
:multi="true"
@input="popupCallback"
/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number"> <a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="goodimg">
<a-input-number v-model="model.number" placeholder="请输入数量" style="width: 100%" /> <j-image-upload isMultiple v-model="model.goodimg" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="款式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="styleId">
<j-search-select-tag v-model="model.styleId" dict="zy_cloths_style,type_name,id" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="面料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp1"> <a-form-model-item label="当前单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">
<a-input v-model="model.temp1" placeholder="请输入面料" ></a-input> <a-input-number v-model="model.price" placeholder="请输入当前单价" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="发货地" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp2"> <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number">
<a-input v-model="model.temp2" placeholder="请输入中间字段临时存储" disabled></a-input> <a-input-number v-model="model.number" placeholder="请输入数量" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="中间字段临时存储" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp3"> <a-form-model-item label="发货地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="placeorigin">
<a-input v-model="model.temp3" placeholder="发货地" disabled ></a-input> <a-input v-model="model.placeorigin" placeholder="请输入发货地" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24"> <a-col :span="24">
<a-form-model-item label="中间字段临时存储" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp4"> <a-form-model-item label="总价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zj">
<a-input v-model="model.temp4" placeholder="请输入中间字段临时存储" ></a-input> <a-input-number v-model="model.zj" placeholder="请输入总价" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col>--> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
</j-form-container> </j-form-container>
</a-spin> </a-spin>
</template> </template>
<script> <script>
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
@ -82,7 +94,7 @@
data () { data () {
return { return {
model:{ model:{
}, },
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 }, sm: { span: 5 },
@ -93,6 +105,10 @@
}, },
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
number: [
{pattern: /^\d*\$/,message:'请输入大于0的数'},
],
}, },
url: { url: {
add: "/customershoppingcart/customerShoppingCart/add", add: "/customershoppingcart/customerShoppingCart/add",
@ -107,7 +123,7 @@
}, },
}, },
created () { created () {
//model //model
this.modelDefault = JSON.parse(JSON.stringify(this.model)); this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
methods: { methods: {
@ -131,7 +147,7 @@
method = 'post'; method = 'post';
}else{ }else{
httpurl+=this.url.edit; httpurl+=this.url.edit;
method = 'put'; method = 'put';
} }
httpAction(httpurl,this.model,method).then((res)=>{ httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){ if(res.success){

@ -118,6 +118,7 @@ public class CustomerShoppingCartController extends JeecgController<CustomerShop
@ApiOperation(value="购物车-添加", notes="购物车-添加") @ApiOperation(value="购物车-添加", notes="购物车-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody CustomerShoppingCart customerShoppingCart) { public Result<?> add(@RequestBody CustomerShoppingCart customerShoppingCart) {
customerShoppingCart.setZj(customerShoppingCart.getNumber() * customerShoppingCart.getPrice());
customerShoppingCartService.save(customerShoppingCart); customerShoppingCartService.save(customerShoppingCart);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -132,6 +133,7 @@ public class CustomerShoppingCartController extends JeecgController<CustomerShop
@ApiOperation(value="购物车-编辑", notes="购物车-编辑") @ApiOperation(value="购物车-编辑", notes="购物车-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody CustomerShoppingCart customerShoppingCart) { public Result<?> edit(@RequestBody CustomerShoppingCart customerShoppingCart) {
customerShoppingCart.setZj(customerShoppingCart.getNumber() * customerShoppingCart.getPrice());
customerShoppingCartService.updateById(customerShoppingCart); customerShoppingCartService.updateById(customerShoppingCart);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }

@ -33,65 +33,70 @@ import lombok.experimental.Accessors;
public class CustomerShoppingCart implements Serializable { public class CustomerShoppingCart implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**主键*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private String id; private java.lang.String id;
/**创建人*/ /**创建人*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private java.lang.String createBy;
/**创建日期*/ /**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private java.util.Date createTime;
/**更新人*/ /**更新人*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private java.lang.String updateBy;
/**更新日期*/ /**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private Date updateTime; private java.util.Date updateTime;
/**所属部门*/ /**所属部门*/
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String sysOrgCode; private java.lang.String sysOrgCode;
/**用户*/ /**用户*/
@Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Excel(name = "用户", width = 15)
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@ApiModelProperty(value = "用户") @ApiModelProperty(value = "用户")
private String userId; private java.lang.String userId;
/**商品*/ /**用户*/
@Excel(name = "商品", width = 15, dictTable = "zy_goods", dicText = "goods_name", dicCode = "id") @Excel(name = "用户", width = 15)
@Dict(dictTable = "zy_goods", dicText = "goods_name", dicCode = "id") @ApiModelProperty(value = "用户")
private java.lang.String username;
/**商品*/
@Excel(name = "商品", width = 15, dictTable = "zy_goods", dicText = "goods_name", dicCode = "id")
@Dict(dictTable = "zy_goods", dicText = "goods_name", dicCode = "id")
@ApiModelProperty(value = "商品")
private java.lang.String goodsId;
/**商品*/
@Excel(name = "商品", width = 15)
@ApiModelProperty(value = "商品") @ApiModelProperty(value = "商品")
private String goodsId; private java.lang.String goodsname;
/**当前单价*/
@Excel(name = "当前单价", width = 15) /**图片*/
@Excel(name = "图片", width = 15)
@ApiModelProperty(value = "图片")
private java.lang.String goodimg;
/**款式*/
@Excel(name = "款式", width = 15)
@ApiModelProperty(value = "款式")
private java.lang.String styleId;
/**当前单价*/
@Excel(name = "当前单价", width = 15)
@ApiModelProperty(value = "当前单价") @ApiModelProperty(value = "当前单价")
private Double price; private java.lang.Double price;
/**数量*/ /**数量*/
@Excel(name = "数量", width = 15) @Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer number; private java.lang.Integer number;
/**中间字段临时存储*/ /**发货地址*/
@Excel(name = "中间字段临时存储", width = 15) @Excel(name = "发货地址", width = 15)
@ApiModelProperty(value = "中间字段临时存储") @ApiModelProperty(value = "发货地址")
private String temp1; private java.lang.String placeorigin;
/**中间字段临时存储*/ /**总价*/
@Excel(name = "中间字段临时存储", width = 15) @Excel(name = "总价", width = 15)
@ApiModelProperty(value = "中间字段临时存储") @ApiModelProperty(value = "总价")
private String temp2; private java.lang.Double zj;
/**中间字段临时存储*/
@Excel(name = "中间字段临时存储", width = 15)
@ApiModelProperty(value = "中间字段临时存储")
private String temp3;
/**中间字段临时存储*/
@Excel(name = "中间字段临时存储", width = 15)
@ApiModelProperty(value = "中间字段临时存储")
private String temp4;
/**图片字段*/
@Excel(name = "图片字段", width = 15)
@ApiModelProperty(value = "图片字段")
private String temiimg;
} }

Loading…
Cancel
Save