1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
| <template>
| <div class="main_index">
| <div class="search_from">
| <el-form
| :model="formInline"
| inline
| label-width="100px"
| class="form-flex"
| size="small"
| >
| <div style="width: 90%">
| <el-form-item label="项目名称:">
| <el-input
| v-model.trim="formInline.projName"
| style="width: 240px"
| @keyup.native="keyupEvent($event)"
| type="tel"
| clearable
| placeholder="请输入"
| ></el-input>
| </el-form-item>
| <el-form-item label="创建时间:">
| <el-date-picker
| v-model="createdTime"
| style="width: 240px"
| format="yyyy-MM-dd"
| value-format="yyyy-MM-dd"
| type="daterange"
| range-separator="-"
| start-placeholder="开始日期"
| end-placeholder="结束日期"
| >
| </el-date-picker>
| </el-form-item>
| <el-form-item label="项目状态:">
| <el-select
| v-model="formInline.status"
| style="width:240px"
| clearable
| placeholder="请选择"
| >
| <el-option label="全部" value="all"></el-option>
| <el-option
| v-for="item in relustObj.statusList"
| :key="item.code"
| :label="item.name"
| :value="item.code"
| ></el-option>
| </el-select>
| </el-form-item>
| </div>
| <el-form-item style="text-align: right;">
| <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;" v-if='filterBtnById("150102")' @click="addProduct">新 增</el-button>
| <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;" @click="onSearch">查 询</el-button>
| </el-form-item>
| </el-form>
| </div>
| <div class="table_box">
| <Etable
| hasIndex
| httpUrl="projectList"
| :columns="columns"
| :searchData="searchData"
| @getDataList="getDataList"
| :exportUrl="{
| url: '/qyp/project/export',
| powerId: '150103',
| name: '项目列表',
| }"
| ></Etable>
| </div>
| <el-dialog top="8vh" title="新增商品" :visible.sync="addProd" width="60%">
| <!-- 新增商品名称 -->
|
|
| </el-dialog>
| </div>
| </template>
|
| <script>
| import Etable from "../../components/table.vue";
| import {projectInit,projectAdd,projectDtl,projectUpdata} from "@/api/credit";
| // import orderDetail from "./orderDetail.vue";
| import uploadImg from "@/components/upload.vue";
| import MultipleSelect from "../../components/secect.vue";
| import moment from 'moment';
| export default {
| name: "order",
| components: { Etable, MultipleSelect, uploadImg },
| data() {
| let validateImage = (rule, value, callback) => { //验证器
| if (!this.payForm.prodListImages.length) { //为true代表图片在 false报错
| callback(new Error('请上传商品展示图片'));
| } else {
| callback();
| }
| };
| let validateImage1 = (rule, value, callback) => { //验证器
| if (!this.payForm.prodImages.length) { //为true代表图片在 false报错
| callback(new Error('请上传商品轮播图'));
| } else {
| callback();
| }
| };
| let validateImage2 = (rule, value, callback) => { //验证器
| if (!this.payForm.prodDescImages.length) { //为true代表图片在 false报错
| callback(new Error('请上传商品详情图片'));
| } else {
| callback();
| }
| };
| return {
| disabled: true,
| payForm: {
| prodImages: [],
| prodListImages:[],
| prodDescImages:"",
| },
| licensePaths: [],
| prodListImages:[],
| prodDescImages:[],
| payFormRule: {
| prodListImage:[{ required: true, trigger: "change",validator: validateImage}],
| prodImages:[{ required: true, trigger: "change",validator: validateImage1}],
| prodDescImages:[{ required: true, trigger: "change",validator: validateImage2}],
| desc: [{ required: true, message: "请输入商品简介", trigger: "blur" }],
| status:[{ required: true, message: "请选择上架状态", trigger: "change" }]
| },
| formInline: {
| status:"all",
| },
| searchData: {},
| columns: [
| {
| lable: "项目名称",
| prop: "projName",
| align: "center",
| width: "300",
| },
| {
| lable: "项目价格",
| prop: "projPrice",
| align: "center",
| width: "180",
| },
| {
| lable: "项目链接",
| prop: "projUrl",
| align: "center",
| width: "200",
| },
| {
| lable: "创建时间",
| prop: "creTime",
| align: "center",
| width: "150",
| },
| {
| lable: "项目状态",
| prop: "statusStr",
| align: "center",
| width: "180",
| },
| {
| lable: "项目描述",
| prop: "projDesc",
| align: "center",
| },
| {
| lable: "",
| },
| {
| lable: "操作",
| align: "center",
| width: "180",
| fixed: "right",
| render: (h, scope) => {
| return h("div", [
| h(
| "span",
| {
| style: {
| cursor: "pointer",
| color: "#3C8EFE",
| display: this.filterBtnById(150101)
| ? "inline-block"
| : "none",
| },
| on: {
| click: () => {
|
| },
| },
| },
| "查看详情"
| ),
| h(
| "span",
| {
| style: {
| cursor: "pointer",
| "margin-left": "8px",
| color: "#3C8EFE",
| display: this.filterBtnById(150104)
| ? "inline-block"
| : "none",
| },
| on: {
| click: () => {
|
| },
| },
| },
| "编辑"
| ),
| ]);
| },
| },
| ],
| relustObj: {},
| addProd:false,
| createdTime:[]
| }
| },
| //生命周期 - 创建完成(可以访问当前this实例)
| created() {
| this.initSerch();
| },
| methods: {
| keyupEvent(e) {
| //只能输入整数
| e.target.value = e.target.value.replace(/[^\d]/g, "");
| },
| addPDH(){
| this.$refs['skuObj'].validate((valid) => {
| if(valid){
| let {productAttr,prodName,prodFundType,prodOsType} = this.skuObj;
| let data = {prodName,prodFundType,prodOsType,prodBrandCode:productAttr[1].value,prodModelCode:productAttr[2].value,prodType:productAttr[0].value};
| prodAdd(data).then((res)=>{
| this.addProd = false;
| this.initSerch();
| })
| }
| })
| },
| addPDHCancelBut(){
| this.$refs["skuObj"].resetFields();
| this.addProd = false;
| },
| addProduct(){
| this.disabled = false;
| },
| onSearch() {
| if (this.createdTime && this.createdTime.length) {
| this.formInline.creStartTime = this.createdTime[0];
| this.formInline.creEndTime = this.createdTime[1];
| } else {
| this.formInline.creStartTime = null;
| this.formInline.creEndTime = null;
| }
| let objForm = JSON.parse(JSON.stringify(this.formInline));
| for (let key in objForm) {
| if (objForm[key] === "all") {
| delete objForm[key];
| }
| }
| this.searchData = { ...objForm };
| },
| initSerch() {
| projectInit().then(({ body }) => {
| this.relustObj = body;
| });
| },
| prodListInit() {
| prodListInit().then(({ body }) => {
| let prodList = body.items.map(f=>{
| return {
| code:f.prodId,
| name:f.prodName
| }
| });
| this.relustObj.prodList = prodList;
| });
| },
| getDataList(e) {
| },
| // prodDescSend(e){
| // //文件上传
| // this.payForm.prodDescImages = e.map((res) => {
| // return res.filePath;
| // });
| // this.$refs.prodDescImagesIplaod.clearValidate();
| // },
| // productShowUSend(e){
| // this.payForm.prodListImages = e.map((res) => {
| // return res.filePath;
| // });
| // this.$refs.productShowUpload.clearValidate();
| // },
| }
| };
| </script>
|
| <style scoped lang="scss">
| .main_index {
| background-color: #f0f2f5;
| .table_box_num {
| margin-top: 5px;
| display: flex;
| justify-content: flex-end;
| align-items: center;
| color: #666;
| font-size: 14px;
| font-weight: bold;
| padding-right: 16px;
| box-sizing: border-box;
| span {
| display: inline-block;
| &:nth-child(even) {
| margin-right: 20px;
| color: #333;
| }
| }
| }
| .el-form-div {
| width: 100%;
| display: flex;
| }
| .tips{
| color: #f56c6c;
| }
| }
| </style>
|
|
|