| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <div>
- <el-button size="mini" type="primary" @click="onshow">{{data.isonsale === 0?'上 架':'下 架'}}</el-button>
- <el-dialog
- title="提示"
- :visible.sync="upVisible"
- width="25%"
- append-to-body
- >
- <span>确定上架该商品组吗</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="upVisible = false" size="small">取 消</el-button>
- <el-button type="primary" @click="shelvesUp" size="small">确 定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="提示"
- :visible.sync="downVisible"
- width="25%"
- append-to-body
- >
- <span>确定下架该商品组吗</span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="downVisible = false" size="small">取 消</el-button>
- <el-button type="primary" @click="shelvesDown" size="small">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- name: "shelves",
- props:["data"],
- data(){
- return {
- upVisible:false,
- downVisible:false
- }
- },
- methods:{
- onshow(){
- console.log("输出数据")
- console.log(this.data)
- if (this.data.isonsale === 0){
- this.openUp()
- }else {
- this.openDown()
- }
- },
- openUp() {
- this.$confirm('确定上架该商品组吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- closeOnClickModal:false,
- type: 'warning'
- }).then(() => {
- this.shelvesUp()
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消上架'
- });
- });
- },
- openDown() {
- this.$confirm('确定下架该商品组吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- closeOnClickModal:false,
- type: 'warning'
- }).then(() => {
- this.shelvesDown()
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消下架'
- });
- });
- },
- async shelvesUp(){
- const res = await this.$api.requested({
- "id": "20220923143603",
- "content": {
- "sa_itemgroupids":[this.data.sa_itemgroupid]
- }
- })
- this.tool.showMessage(res,()=>{
- this.upVisible = false
- this.$emit("upSuccess")
- })
- },
- async shelvesDown(){
- const res = await this.$api.requested({
- "id": "20220923143703",
- "content": {
- "sa_itemgroupids":[this.data.sa_itemgroupid]
- }
- })
- this.tool.showMessage(res,()=>{
- this.downVisible = false
- this.$emit("upSuccess")
- })
- }
- },
- mounted() {
- }
- }
- </script>
- <style scoped>
- </style>
|