| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518 |
- <template>
- <div class="batch-publish">
- <p>成功上传<b class="red-text">{{bomNumber.successImport || 0}}</b>个<br/>另有<span class="red-text">{{bomNumber.nullField || 0}}</span>个必填项缺失,请在当前页完善信息</p>
- <table v-if="bomList.content.length">
- <thead>
- <tr>
- <th width="60">
- <label class="com-check-box">
- <input type="checkbox" id="all" @change="onCheck()" v-model="isCheckAll">
- <label for="all"></label>
- </label>全选
- </th>
- <th width="160"><i class="red-text">*</i>型号</th>
- <th width="132"><i class="red-text">*</i>品牌</th>
- <th width="100">采购数量</th>
- <th width="128">单价预算</th>
- <th width="76">封装</th>
- <th width="102">生产日期</th>
- <th width="144"><i class="red-text">*</i>截止时间</th>
- <th width="92">操作</th>
- </tr>
- </thead>
- <tbody v-for="(item, index) in bomList.content">
- <tr v-if="!item.active">
- <td>
- <label class="com-check-box">
- <input type="checkbox" @change="onCheck(index)" v-model="item.checked" :id="index">
- <label :for="index"></label>
- </label>
- </td>
- <td>{{item.code}}</td>
- <td>{{item.brand}}</td>
- <td>{{item.amount || '-'}}</td>
- <td class="blue-text">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</td>
- <td>{{item.encapsulation || '-'}}</td>
- <td>{{item.produceDate}}</td>
- <td>{{item.deadline | date}}</td>
- <td class="operate">
- <a class="delete-btn" @click="modifyItem(index)">编辑</a>
- <a class="delete-btn" @click="deleteItem(index)">删除</a>
- </td>
- </tr>
- <tr class="modify-row" v-if="item.active">
- <td>
- <label class="com-check-box">
- <input type="checkbox" @change="onCheck(index)" v-model="item.checked" :id="index">
- <label :for="index"></label>
- </label>
- </td>
- <td>
- <input type="text" class="form-control" v-model="modifyObj.code">
- </td>
- <td>
- <input type="text" class="form-control" v-model="modifyObj.brand">
- </td>
- <td>
- <input type="text" class="form-control" v-model="modifyObj.amount">
- </td>
- <td>
- <select class="form-control" v-model="modifyObj.currency">
- <option value="RMB">¥</option>
- <option value="USD">$</option>
- </select>
- <input class="form-control" type="text" v-model="modifyObj.unitPrice">
- </td>
- <td>
- <input type="text" class="form-control" v-model="modifyObj.encapsulation">
- </td>
- <td>
- <input type="text" class="form-control" v-model="modifyObj.produceDate">
- </td>
- <td>
- <el-date-picker
- v-model="modifyObj.deadline"
- type="date"
- :picker-options="pickerOptions"
- :editable="false"
- :clearable="true"
- size="mini">
- </el-date-picker>
- <!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
- </td>
- <td class="operate">
- <a class="submit-btn" @click="submitModify(index)">确认</a>
- <a class="cancel-btn" @click="cancelModify(index)">取消</a>
- </td>
- </tr>
- </tbody>
- </table>
- <page :total="bomList.totalElements" :page-size="pageSize"
- :current="nowPage" @childEvent="listenPage"></page>
- <div class="submit-area" v-if="bomList.content.length">
- <a class="delete-btn" @click="deleteItem()">删除</a>
- <a class="modify-btn delete-btn" @click="submitBOM">确认发布</a>
- </div>
- <!--提示框-->
- <div class="apply-del-box" v-if="showRemindBox">
- <div class="title">
- <a @click="showRemindBox = false"><i class="fa fa-close fa-lg"></i></a>
- </div>
- <div class="content">
- <!--<p style="line-height: 20px;margin-top: 10px;padding:0 10px">非常抱歉,目前暂无此品牌!<br>若直接前往“品牌申请”,我们将为您先开通寄售功能,待申请通过后再提交开店申请。</p>-->
- <!--<p style="line-height: 20px;">前往<a @click="goBrandApply()" target="_blank" style="color: #5078CB">品牌申请 <i class="fa fa-arrow-right"></i></a></p>-->
- <p><img src="/images/applyPurchase/check.png" alt="">发布成功</p>
- <p>其中<span>100</span>个求购型号有现货在售,您可前往“<span>买家中心-我的求购</span>”查询并直接购买</p>
- <div>
- <a @click="showRemindBox = false">继续发布</a>
- <a href="/user#/seekPurchase">前往我的求购</a>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Page from '~components/common/page/pageComponent.vue'
- export default {
- data () {
- return {
- pageSize: 10,
- nowPage: 1,
- isCheckAll: false,
- showRemindBox: false,
- modifyObj: {},
- pickerOptions: {
- disabledDate (time) {
- // 大于等于今天 小于三个月后
- return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
- }
- }
- }
- },
- components: {
- Page
- },
- computed: {
- bomList () {
- let list = this.$store.state.applyPurchase.bomMaterial.bomList.data
- for (let i = 0; i < list.content.length; i++) {
- list.content[i].checked = false
- list.content[i].active = false
- }
- return list
- },
- bomNumber () {
- return this.$store.state.applyPurchase.bomMaterial.bomNumber.data
- }
- },
- filters: {
- date: function (input) {
- const d = new Date(input)
- const year = d.getFullYear()
- const monthTemp = d.getMonth() + 1
- const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
- const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
- return year + '-' + month + '-' + day
- }
- },
- methods: {
- listenPage: function (page) {
- this.nowPage = page
- this.$store.dispatch('applyPurchase/loadBOMMaterialList', {bomId: this.$route.params.id, page: this.nowPage, count: this.pageSize})
- },
- submitBOM: function () {
- let str = ''
- for (let i = 0; i < this.bomList.content.length; i++) {
- if (this.bomList.content[i].checked) {
- str += this.bomList.content[i].id + ','
- }
- }
- let param = {'bomId': Number(this.$route.params.id)}
- if (str.length) {
- str = str.substring(0, str.length - 1)
- param.spIds = str
- }
- this.$http.post('/seek/confirmBom', param)
- .then(response => {
- if (response.data.success) {
- this.showRemindBox = true
- this.listenPage(1)
- this.$store.dispatch('applyPurchase/loadBOMNumber', {bomId: this.$route.params.id})
- } else {
- this.$message.error('发布失败')
- }
- }, err => {
- console.log(err)
- this.$message.error('系统错误')
- })
- },
- onCheck: function (index) {
- if (typeof index === 'undefined') {
- let isCheckedAll = true
- for (let i = 0; i < this.bomList.content.length; i++) {
- if (!this.bomList.content[i].checked) {
- isCheckedAll = false
- break
- }
- }
- this.setAllCheck(!isCheckedAll)
- this.isCheckAll = !isCheckedAll
- }
- },
- setAllCheck: function (flag) {
- for (let i = 0; i < this.bomList.content.length; i++) {
- this.bomList.content[i].checked = flag
- }
- },
- modifyItem: function (index) {
- for (let i = 0; i < this.bomList.content.length; i++) {
- this.bomList.content[i].active = false
- }
- this.bomList.content[index].active = true
- this.modifyObj = this.bomList.content[index]
- this.modifyObj.deadline = this.getDate(this.bomList.content[index].deadline)
- },
- cancelModify: function (index) {
- this.bomList.content[index].active = false
- },
- getDate: function (input) {
- const d = new Date(input)
- const year = d.getFullYear()
- const monthTemp = d.getMonth() + 1
- const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
- const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
- return year + '-' + month + '-' + day
- },
- submitModify: function (index) {
- this.$http.put('/seek/updateSeekPurchaseByBatch', this.modifyObj)
- .then(response => {
- if (response.data.success) {
- this.listenPage(1)
- this.$message.success('修改成功')
- this.bomList.content[index].active = false
- } else {
- this.$message.error('修改失败')
- }
- }, err => {
- console.log(err)
- this.$message.error('系统错误')
- })
- },
- deleteItem: function (index) {
- if (!index) {
- let str = ''
- for (let i = 0; i < this.bomList.content.length; i++) {
- if (this.bomList.content[i].checked) {
- str += this.bomList.content[i].id + ','
- }
- }
- let param = {}
- if (str.length) {
- str = str.substring(0, str.length - 1)
- param.spIds = str
- this.doDelete(param)
- } else {
- this.$message.error('请勾选')
- return
- }
- } else {
- this.doDelete({spIds: this.bomList.content[index].id})
- }
- },
- doDelete: function (param) {
- this.$http.put('/seek/deleteSeekPurchaseByBatch', param)
- .then(response => {
- if (response.data.success) {
- this.listenPage(1)
- this.$message.success('删除成功')
- } else {
- this.$message.error('删除失败')
- }
- }, err => {
- console.log(err)
- this.$message.error('系统错误')
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .batch-publish {
- margin: 0 auto;
- width: 998px;
- .red-text {
- color: #ff0000;
- }
- .blue-text {
- color: #3c7cf5;
- }
- > p {
- margin: 59px 0 42px;
- font-size: 16px;
- }
- table {
- width: 100%;
- table-layout: fixed;
- thead {
- tr {
- th {
- background: #b8b8b8;
- color: #fff;
- font-weight: normal;
- height: 50px;
- line-height: 50px;
- text-align: center;
- .com-check-box {
- margin-right: 2px;
- }
- i {
- margin-right: 3px;
- }
- }
- }
- }
- tbody {
- tr {
- height: 85px;
- line-height: 85px;
- text-align: center;
- border : {
- bottom: 1px solid #d9d9d9;
- left: 1px solid #d9d9d9;
- right: 1px solid #d9d9d9;
- }
- &:hover {
- background: #f3f3f3;
- }
- td {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- &.operate {
- a {
- display: block;
- width: 64px;
- height: 24px;
- line-height: 22px;
- text-align: center;
- border-radius: 3px;
- margin: 0 auto 4px;
- &.submit-btn {
- border: 1px solid #f64900;
- color: #fff;
- background: #f64900;
- }
- &.cancel-btn {
- border: 1px solid #bbb;
- color: #fff;
- background: #bbb;
- }
- }
- }
- }
- &.modify-row {
- td {
- position: relative;
- input, select {
- height: 20px;
- border-radius: 3px;
- background: #f4f4f4;
- border: 1px solid #b5b5b5;
- text-align: center;
- padding: 0 5px;
- }
- &:nth-child(2) {
- input {
- width: 113px;
- }
- }
- &:nth-child(3) {
- input {
- width: 93px;
- }
- }
- &:nth-child(4) {
- input {
- width: 71px;
- }
- }
- &:nth-child(5) {
- input {
- width: 65px;
- padding: 0 5px 0 30px;
- }
- select {
- width: 25px;
- padding: 0 0 0 2px;
- background: url(/images/applyPurchase/select.png) no-repeat right;
- background-size: 12px 19px;
- background-position: 13px 0px;
- position: absolute;
- top: 33px;
- border-bottom: none;
- border-top: none;
- border-left: 0;
- }
- }
- &:nth-child(6) {
- input {
- width: 54px;
- }
- }
- &:nth-child(7) {
- input {
- width: 72px;
- }
- }
- &:nth-child(8) {
- div {
- width: 101px;
- input {
- width: 101px;
- }
- }
- }
- }
- }
- }
- }
- }
- .modify-btn {
- border: 1px solid #3c7cf5;
- color: #3c7cf5;
- }
- .delete-btn {
- border: 1px solid #3c7cf5;
- color: #fff;
- background: #3c7cf5;
- }
- .submit-area {
- margin: 51px auto 60px;
- text-align: center;
- clear: both;
- a {
- display: inline-block;
- width: 64px;
- height: 24px;
- line-height: 22px;
- text-align: center;
- border-radius: 3px;
- &.modify-btn {
- width: 90px;
- margin-left: 14px;
- }
- }
- }
- .apply-del-box{
- position: fixed;
- z-index: 1000;
- height: auto;
- opacity: 1;
- background-color: white;
- width: 310px;
- -webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
- -moz-box-shadow: 0 5px 15px rgba(0,0,0,.5);
- -o-box-shadow: 0 5px 15px rgba(0,0,0,.5);
- box-shadow: 0 5px 15px rgba(0,0,0,.5);
- margin: -155px 0 0 -75px;
- top: 55%;
- left: 43%;
- .title{
- height: 24px;
- background-color: #007aff;
- text-align: right;
- padding-right: 15px;
- line-height: 24px;
- a{
- color: white;
- font-size: 12px;
- }
- }
- .content{
- width: 100%;
- text-align: center;
- margin: 0 auto;
- p{
- padding: 12px 31px;
- margin: 0;
- &:nth-child(2) {
- font-size: 12px;
- padding-top: 0;
- }
- i{
- color: #5078cb;
- font-size: 16px;
- margin-right: 10px;
- }
- span {
- color: #007aff;
- }
- &:last-child {
- font-size: 12px;
- }
- }
- div{
- width: 100%;
- text-align: center;
- margin: 0 auto 20px;
- a{
- padding: 0 19px;
- height: 26px;
- line-height: 26px;
- display: inline-block;
- text-align: center;
- font-size: 14px;
- color: #fff;
- &:first-child{
- background: #c8c6c6;
- margin-right: 10px;
- }
- &:last-child{
- background: #007aff;
- }
- }
- }
- }
- }
- }
- </style>
|