123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <template>
- <el-dialog
- :title="'选择已上线的商品'"
- :center="true"
- align="left"
- top="8vh"
- width="1040px"
- @close="showModelThis = false"
- :close-on-click-modal="false"
- :visible.sync="showModelThis"
- v-loading="loading"
- element-loading-text="拼命加载中"
- element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- append-to-body
- >
- <el-card style="margin-top: -20px" class="modal-form-style">
- <ex-table
- v-loading="loading"
- :table="table"
- :data="tableData"
- :columns="columns"
- :page="pageInfo"
- :size="'mini'"
- @page-curr-change="handlePageChange"
- @page-size-change="handleSizeChange"
- @screen-reset="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- @screen-submit="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- >
- <template #table-header="{ selection }">
- <div style="width: 100%">
- <el-row style="margin-top: -15px">
- <el-col :span="24">
- <el-col :span="4" style="width: 220px">
- <el-input
- :size="'mini'"
- v-model="parmValue.buy_num"
- :maxlength="40"
- disabled
- placeholder="起订量"
- ><template slot="prepend">起订量:</template></el-input
- >
- </el-col>
- <el-col :span="4" style="width: 460px; padding: 0 0 0 10px">
- <el-input
- :size="'mini'"
- v-model="company"
- :maxlength="40"
- clearable
- disabled
- placeholder="业务公司"
- />
- </el-col>
- <el-col :span="3" class="fr" style="width: 66px">
- <el-button
- :size="'mini'"
- type="primary"
- style="float: right; margin-left: 5px"
- @click="searchList"
- >
- 刷新
- </el-button>
- </el-col>
- <el-col :span="4" class="fr" style="width: 66px">
- <el-button
- type="warning"
- class="fr"
- :size="'mini'"
- @click="restSearch"
- >
- 重置
- </el-button>
- </el-col>
- </el-col>
- <el-col :span="24" style="padding: 10px 0 0 0">
- <el-col :span="4" style="width: 220px">
- <el-input
- :size="'mini'"
- v-model="parmValue.price"
- :maxlength="40"
- disabled
- placeholder="预算单价"
- ><template slot="prepend">售 价 ≤</template></el-input
- >
- </el-col>
- <el-col :span="4" style="width: 250px; padding: 0 0 0 10px">
- <el-input
- :size="'mini'"
- v-model="platform_name"
- :maxlength="40"
- clearable
- disabled
- placeholder="所属平台"
- />
- </el-col>
- <el-col :span="4" style="width: 280px; padding: 0 0 0 10px">
- <good-class
- :value="parmValue.cat_id"
- @handleChange="goods_class_change"
- :disabled="false"
- :size="'mini'"
- :isDetail="sitem.can_id !== ''"
- :placeholder="'分类'"
- />
- </el-col>
- <el-col :span="3" style="width: 66px; float: right">
- <el-button
- :size="'mini'"
- type="success"
- style="float: right; margin-left: 5px"
- @click="resultList(selection)"
- >
- 保存
- </el-button>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- </ex-table>
- </el-card>
- </el-dialog>
- </template>
- <script>
- import asyncRequest from "@/apis/service/sellOut/project";
- import resToken from "@/mixins/resToken";
- import mixinPage from "@/mixins/elPaginationHandle";
- import { mapGetters } from "vuex";
- import columns from "./columns";
- export default {
- name: "searchGoodOnlineTableModal",
- mixins: [resToken, mixinPage],
- computed: {
- ...mapGetters(["tablebtnSize", "searchSize", "size"]),
- },
- props: ["showModel", "sitem"],
- /**
- * 属性集合
- * @param {Boolean} showModel : 是否弹出弹窗 必填
- * @param {Boolean} once : 是否只选一条 非必填
- */
- /**
- * 事件集合
- * @searchChange : 选中值变化调用 抛出选中数据
- */
- data() {
- return {
- options: [
- { id: "0", name: "非库存品" },
- { id: "1", name: "库存品" },
- ],
- company: "",
- platform_name: "",
- selectLoading: false,
- searchName: "",
- loading: true,
- showModelThis: false,
- parmValue: {
- buy_num: "", // 商品购买数量
- price: "", // 单价
- cat_id: "", // 分类id
- companyNo: "", // 业务公司id
- platform_code: "", //平台编号id
- page: 1, // 页码
- size: 15, // 每页显示条数
- },
- tableData: [],
- passwordModel: false,
- passwordModelId: 0,
- isPasswordDetail: false,
- // 表格 - 数据
- tableData: [],
- // 表格 - 参数
- table: {
- stripe: true,
- border: true,
- // _defaultHeader_: ["setcol"],
- },
- // 表格 - 分页
- pageInfo: {
- size: 15,
- curr: 1,
- total: 0,
- },
- // 表格 - 列参数
- columns: columns,
- };
- },
- watch: {
- showModel: function (val) {
- this.showModelThis = val;
- if (val) {
- this.restSearch();
- }
- },
- showModelThis(val) {
- if (!val) {
- this.$emit("cancel");
- }
- },
- },
- methods: {
- restSearch() {
- console.log(this.sitem);
- const {
- platform_id,
- companyNo,
- num,
- cat_id,
- budget_price,
- company,
- platform_name,
- } = this.sitem;
- console.log(this.sitem);
- this.company = company;
- this.platform_name = platform_name;
- this.parmValue = {
- buy_num: num, // 商品购买数量
- price: budget_price, // 单价
- cat_id: "", // 分类id
- companyNo: companyNo, // 业务公司id
- platform_code: platform_id, //平台编号id
- page: 1, // 页码
- size: 15, // 每页显示条数
- };
- // 表格 - 分页
- this.pageInfo = {
- size: 15,
- curr: 1,
- total: 0,
- };
- this.searchList();
- },
- async searchList() {
- this.loading = true;
- const res = await asyncRequest.get_good_online_list(this.parmValue);
- if (res && res.code === 0 && res.data) {
- this.tableData = res.data.list;
- // this.tableData.map((v) => {
- // // v.sale_price = this.setNum(v.sale_price);
- // // v.sale_fee = this.setNum(v.sale_fee);
- // // // v.num =
- // // //pa (v.sale_price);
- // return v;
- // });
- //
- this.pageInfo.total = Number(res.data.count);
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.tableData = [];
- this.pageInfo.total = 0;
- }
- this.loading = false;
- },
- async remoteMethod(query) {
- this.selectLoading = true;
- if (query !== "") {
- this.options = [];
- let formValue = {
- page: 1,
- size: 100,
- name: query,
- code: "",
- };
- let res = await asyncRequest.supplierList(formValue);
- if (res && res.code === 0 && res.data) {
- const { list } = res.data;
- this.options = list;
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(res.message);
- }
- } else {
- this.options = [];
- }
- this.selectLoading = false;
- },
- async resultList(selection) {
- if (selection && selection.length > 1 && this.once) {
- this.$message.warning("只能选择一条商品信息!");
- return;
- }
- this.loading = true;
- let model = {
- pgNo: this.sitem.pgNo,
- spuCode: [],
- source: "1",
- };
- selection.forEach((a) => {
- model.spuCode.push(a.skuCode);
- });
- let { code, data, message } = await asyncRequest.project_online_good_add(
- model
- );
- this.loading = false;
- if (code === 0) {
- this.$notify.success({
- title: "添加成功!",
- message: "",
- });
- this.showModelThis = false;
- this.$emit("submitRes", this.sitem.pgNo_index);
- } else if (code >= 100 && code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(message);
- }
- },
- },
- };
- </script>
- <style>
- </style>
|