Commit c59229fb by 张立顺

功能提交

1 parent 6b0b2b3c
...@@ -70,6 +70,10 @@ $prefix: d2; ...@@ -70,6 +70,10 @@ $prefix: d2;
margin-right: 40px; margin-right: 40px;
} }
.pointer {
cursor: pointer;
}
.cancel-btn { .cancel-btn {
width: 100px; width: 100px;
color: #ffffff; color: #ffffff;
...@@ -86,6 +90,7 @@ $prefix: d2; ...@@ -86,6 +90,7 @@ $prefix: d2;
// padding-left: 20px; // padding-left: 20px;
margin: 0 0; margin: 0 0;
} }
.edit-sub-title::before { .edit-sub-title::before {
position: absolute; position: absolute;
display: inline-block; display: inline-block;
...@@ -185,6 +190,7 @@ $prefix: d2; ...@@ -185,6 +190,7 @@ $prefix: d2;
.tips-block { .tips-block {
position: relative; position: relative;
} }
.tips-label { .tips-label {
margin-right: 20px; margin-right: 20px;
} }
...@@ -201,7 +207,8 @@ $prefix: d2; ...@@ -201,7 +207,8 @@ $prefix: d2;
border: 1px solid #7f7f7f; border: 1px solid #7f7f7f;
border-radius: 50%; border-radius: 50%;
} }
.tips-icon::before{
.tips-icon::before {
content: '?'; content: '?';
position: absolute; position: absolute;
width: 8px; width: 8px;
......
<!-- 表格+分页 -->
<template>
<div>
<el-table :data="getListApi ? data : tableData"
v-loading="loading"
border
:highlight-current-row="true"
:stripe="true"
@sort-change="sortChange">
<el-table-column align="center"
width="60px"
label="序号"
type="index"
:index="index=>index+(pagination.pageSize - 1) * pagination.pageCount + 1" />
<el-table-column v-for="(item, index) in tableParams.tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
:min-width="item.minWidth"
:align="item.align||'center'"
:sortable="item.sortable">
<template slot-scope="scope">
<slot v-if="item.addHtml"
:name="item.addHtml"
:scope="scope.row"
:prop="item.prop"
:mom-flag="item.momFlag" />
<template v-else-if="item.momFlag">
<div>
<span v-text="scope.row[item.prop]" />
<span v-if="scope.row[item.momFlag] > 0"
class="el-icon-top" />
<span v-else-if="scope.row[item.momFlag] < 0"
class="el-icon-bottom" />
<span v-else-if="scope.row[item.momFlag] == 0">--</span>
</div>
</template>
<template v-else-if="item.tagLabel">
<el-tag v-if="!item.tagName"
:type="tableParams.tag.type[scope.row[item.prop]]"
v-text="tableParams.tag.label[scope.row[item.prop]]" />
<el-tag v-else
:type="tableParams[item.tagName].type[scope.row[item.prop]]"
v-text="tableParams[item.tagName].label[scope.row[item.prop]]" />
</template>
<template v-else-if="item.formatter">
<span v-text="item.formatter(scope.row)" />
</template>
<template v-else-if="getListApi">
<p v-text="data[scope.$index][item.prop]" />
</template>
<template v-else>
<p v-text="tableData[scope.$index][item.prop]" />
</template>
</template>
</el-table-column>
<el-table-column v-if="tableParams.tableOption"
label="操作"
:align="tableParams.tableOption.align||'center'"
:width="tableParams.tableOption.width||'200'"
fixed="right">
<template slot-scope="scope">
<slot name="auth-button"
:scope="scope.row" />
</template>
</el-table-column>
</el-table>
<el-pagination v-if="hasPage"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.pageSize"
:page-sizes="[10,20,30,40]"
:page-size="page.pageCount"
:total="getListApi ? total : tableTotal"
layout="sizes,total,->,prev,pager,next,jumper" />
</div>
</template>
<script>
import { deepClone } from '@/common/util'
export default {
name: 'D2Table',
data() {
return {
loading: false,
oldValue: {},
data: [],
// 页码
page: {
pageCount: 10,
pageSize: 1
},
total: 10,
// 排序
sortColum: '',
sort: '',
pagination: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => []
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => []
},
tableTotal: {
type: Number,
default: 10
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
}
},
watch: {
searchForm: {
handler(val) {
const attr = Object.keys(val).find(item => val[item] !== this.oldValue[item])
if (!val[attr] && this.oldValue[attr]) {
this.getListApi ? this.refreshEmit() : this.$emit('refreshTable', this.page)
}
this.oldValue = deepClone(val)
},
deep: true
}
// 调用其他接口,导致表格刷新-标识
// '$store.state.d2admin.refreshtable.value'(val) {
// (val === 'fresh') && this.refreshEmit()
// }
},
mounted() {
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
methods: {
// 排序
sortChange({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() {
this.$emit('searchChange')
this.refreshTable()
},
refreshTable() {
this.loading = true
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
this.pagination = res.pagination ? res.pagination : this.page
this.data = res[this.tableParams.listName]
res.pagination && (this.total = res.pagination.totalCount)
this.loading = false
}).catch(() => {
this.loading = false
})
},
// 页码
handleSizeChange(value) {
this.page.pageCount = value
this.getListApi ? this.refreshTable() : this.$emit('refreshTable', this.page)
},
handleCurrentChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable() : this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.a-click {
cursor: pointer;
}
</style>
<template> <template>
<baseDialog :is-show.sync="dialogShow" <!-- <baseDialog :is-show.sync="dialogShow"
:config="dialogConfig.setting" :config="dialogConfig.setting"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
@closeDialog="handleDetailClose"> @closeDialog="handleDetailClose">
</baseDialog> -->
<!-- <div class="detail-content">
填写地址
</div> -->
<el-drawer class="shoppingCartDrawerCon"
title="收货地址管理"
size="500px"
:visible.sync="dialogShow"
:direction="direction">
<div class="detail-content"> <div class="detail-content">
填写地址 填写地址
</div> </div>
</baseDialog> </el-drawer>
</template> </template>
<script> <script>
export default { export default {
name: 'AddressCom', name: 'AddressCom',
props: {
visible: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
dialogShow: false, // dialogShow: false,
direction: 'rtl',
dialogConfig: { dialogConfig: {
setting: { setting: {
showClose: true, showClose: true,
...@@ -31,6 +48,16 @@ export default { ...@@ -31,6 +48,16 @@ export default {
} }
} }
}, },
computed: {
dialogShow: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
methods: { methods: {
handleDetailClose() { handleDetailClose() {
......
No preview for this file type
No preview for this file type
No preview for this file type
<!-- 采购商城 --> <!-- 采购商城 -->
<template> <template>
<d2-container class="mallContainer"> <d2-container class="mallContainer">
<div class="d2-container-content"> <div class="header addressCon"
<div class="addressCon"> slot="header">
地址 <div class="addressTitle">
<img src="./images/addressIcon.webp"
alt=""
class="icon">
<span class="title">{{ addressInfo.yqMerchantName }}</span>
<span class="edit pointer"
@click="addressComVisible = true">
<img src="./images/editAddressIcon.webp"
alt=""
class="editIcon">
修改
</span>
</div>
<div class="addressInfo">
<!-- 收货人:白敬亭 -->
<span class="name">收货人:<span class="label">{{ addressInfo.contactName }}</span></span>
<span class="phone">电话:<span class="label">{{ addressInfo.contactPhone }}</span></span>
<span class="address">收货地址:<span
class="label">{{ addressInfo.contactAddress }}</span></span>
</div>
</div> </div>
<div class="d2-container-content">
<div class="classifyContainer"> <div class="classifyContainer">
<div class="centerfrom">订阅名</div> <div class="centerfrom">订阅名</div>
<div class="spanall" <div class="spanall"
...@@ -53,7 +74,7 @@ ...@@ -53,7 +74,7 @@
</div> </div>
<!-- 购物车组件 --> <!-- 购物车组件 -->
<shoppingCartCom /> <shoppingCartCom />
<addressCom /> <addressCom :visible.sync="addressComVisible" />
<goodsDetailCom :visible.sync="goodsDetailComVisible" /> <goodsDetailCom :visible.sync="goodsDetailComVisible" />
</d2-container> </d2-container>
</template> </template>
...@@ -74,6 +95,7 @@ export default { ...@@ -74,6 +95,7 @@ export default {
}, },
data() { data() {
return { return {
addressComVisible: false,
goodsDetailComVisible: false, goodsDetailComVisible: false,
searchForm: { searchForm: {
type: '0' type: '0'
...@@ -101,7 +123,9 @@ export default { ...@@ -101,7 +123,9 @@ export default {
addressInfo: { addressInfo: {
contactName: '', contactName: '',
contactPhone: '', contactPhone: '',
contactAddress: '' contactAddress: '',
yqMerchantName: '',
yqMerchantId: ''
}, },
productType: [], productType: [],
productTypeId: '', productTypeId: '',
...@@ -111,7 +135,8 @@ export default { ...@@ -111,7 +135,8 @@ export default {
}, },
created() { created() {
this.getGoodsCategoryConfiguration() this.getGoodsCategoryConfiguration()
// this.listWithPagePurchaseInfo() this.listWithPagePurchaseInfo()
this.addressGet()
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -121,10 +146,12 @@ export default { ...@@ -121,10 +146,12 @@ export default {
}) })
}, },
methods: { methods: {
handleDetail(item) { handleDetail(item) {
this.selectItem = item this.selectItem = item
this.goodsDetailComVisible = true this.goodsDetailComVisible = true
}, },
listWithPagePurchaseInfo() { listWithPagePurchaseInfo() {
const params = { const params = {
pageNum: this.page.pageNum, pageNum: this.page.pageNum,
...@@ -181,20 +208,21 @@ export default { ...@@ -181,20 +208,21 @@ export default {
}, },
addressGet() { addressGet() {
addressGet().then((result) => { addressGet().then((result) => {
console.log(result) // console.log(result)
const { // const {
contactName, // contactName,
contactPhone, // contactPhone,
contactAddress // contactAddress
} = result // } = result
this.addressInfo = { // this.addressInfo = {
contactName, // contactName,
contactPhone, // contactPhone,
contactAddress // contactAddress
} // }
this.addressInfo = result
}).catch((err) => { }).catch((err) => {
console.log(err)
}) })
}, },
// 每页条数 // 每页条数
...@@ -216,6 +244,63 @@ export default { ...@@ -216,6 +244,63 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.mallContainer {
::v-deep .d2-header-switch {
display: none;
}
}
.addressCon {
padding: 10px 20px;
.addressTitle {
display: flex;
align-items: center;
.title {
font-family: PingFangSC-Medium;
font-weight: 600;
font-size: 16px;
color: #333333;
}
.edit {
display: flex;
align-items: center;
margin-left: auto;
font-size: 14px;
color: #185efe;
}
.editIcon {
width: 20px;
height: 20px;
}
}
.icon {
width: 32px;
height: 32px;
margin-right: 8px;
}
.addressInfo {
display: flex;
box-sizing: border-box;
// align-items: space-between;
align-items: center;
justify-content: space-between;
width: 100%;
height: 36px;
padding: 0 20px;
margin-top: 10px;
background: #f9f9f9;
font-size: 14px;
color: #666666;
.label {
color: #333333;
// margin-left: 0px;
}
.address {
min-width: 500px;
}
}
}
.classifyContainer { .classifyContainer {
width: 100%; width: 100%;
display: flex; display: flex;
......
module.exports = { module.exports = {
index: '主页', index: "主页",
'customer/glsx': '广联赛讯' "customer/glsx": "广联赛讯"
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!