|
@@ -0,0 +1,162 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <view class="app-content">
|
|
|
|
|
+ <form @submit="submitPresell">
|
|
|
|
|
+ <div class="module-com input-line-wrap">
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <div class="tui-title">预售状态</div>
|
|
|
|
|
+ <view>
|
|
|
|
|
+ <switch style="transform:scale(0.7,0.7)" :checked="form.presell == 0 ? false : true" @change="presellChangeFn" />
|
|
|
|
|
+ <text v-if="form.presell == 0">关闭</text><text v-else>开启</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <div class="tui-title">日期1</div>
|
|
|
|
|
+ <input v-model="form.date1" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" @click="showDatePicker(1)" name="name" placeholder="请填写日期" />
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <div class="tui-title">日期2</div>
|
|
|
|
|
+ <input v-model="form.date2" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" @click="showDatePicker(2)" name="name" placeholder="请填写日期" />
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <div class="tui-title">日期3</div>
|
|
|
|
|
+ <input v-model="form.date3" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" @click="showDatePicker(3)" name="name" placeholder="请填写日期" />
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
|
|
+ <div class="tui-title">日期4</div>
|
|
|
|
|
+ <input v-model="form.date4" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" @click="showDatePicker(4)" name="name" placeholder="请填写日期" />
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="confirm-btn">
|
|
|
|
|
+ <button class="admin-button-com big blue" formType="submit">添加</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ <mx-date-picker :show="showPicker" format="yyyy-mm-dd" type="date" :value="defaultPickerDate" :show-tips="true" @confirm="confirmPicker" @cancel="cancelPicker" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+import TuiListCell from "@/components/plugin/list-cell";
|
|
|
|
|
+import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
|
|
+import MxDatePicker from '@/components/mx-datepicker/mx-datepicker.vue';
|
|
|
|
|
+import { getProductDetail,changePresell } from "@/api/product";
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: "presell",
|
|
|
|
|
+ components: {
|
|
|
|
|
+ TuiListCell,
|
|
|
|
|
+ AppAvatarModule,
|
|
|
|
|
+ MxDatePicker
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ showPicker:false,
|
|
|
|
|
+ form:{
|
|
|
|
|
+ date1:'',date2:'',date3:'',date4:'',presell:0
|
|
|
|
|
+ },
|
|
|
|
|
+ index:1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ onLoad(){
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ return getProductDetail({ id: this.option.id }).then(res => {
|
|
|
|
|
+ if(res.code == 1){
|
|
|
|
|
+ that.form.presell = res.data.presell
|
|
|
|
|
+ if(res.data.presellDateList && !this.$util.isEmpty(res.data.presellDateList)) {
|
|
|
|
|
+ res.data.presellDateList.forEach((item,idx) => {
|
|
|
|
|
+ if(idx == 0){
|
|
|
|
|
+ that.form.date1 = item
|
|
|
|
|
+ }else if(idx == 1){
|
|
|
|
|
+ that.form.date2 = item
|
|
|
|
|
+ }else if(idx == 2){
|
|
|
|
|
+ that.form.date3 = item
|
|
|
|
|
+ }else if(idx == 3){
|
|
|
|
|
+ that.form.date4 = item
|
|
|
|
|
+ }else{
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ showDatePicker(index){
|
|
|
|
|
+ this.showPicker = true
|
|
|
|
|
+ this.index = index
|
|
|
|
|
+ },
|
|
|
|
|
+ cancelPicker(){
|
|
|
|
|
+ this.showPicker = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmPicker(e) {
|
|
|
|
|
+ this.showPicker = false
|
|
|
|
|
+ if(this.index == 1){
|
|
|
|
|
+ this.form.date1 = e.value
|
|
|
|
|
+ }else if(this.index ==2){
|
|
|
|
|
+ this.form.date2 = e.value
|
|
|
|
|
+ }else if(this.index == 3){
|
|
|
|
|
+ this.form.date3 = e.value
|
|
|
|
|
+ }else if(this.index == 4){
|
|
|
|
|
+ this.form.date4 = e.value
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.$msg('暂无选项')
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ submitPresell(){
|
|
|
|
|
+ let arr = []
|
|
|
|
|
+ if(!this.$util.isEmpty(this.form.date1)){
|
|
|
|
|
+ arr.push(this.form.date1)
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!this.$util.isEmpty(this.form.date2)){
|
|
|
|
|
+ arr.push(this.form.date2)
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!this.$util.isEmpty(this.form.date3)){
|
|
|
|
|
+ arr.push(this.form.date3)
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!this.$util.isEmpty(this.form.date4)){
|
|
|
|
|
+ arr.push(this.form.date4)
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.$util.isEmpty(arr)){
|
|
|
|
|
+ this.$msg('请填写日期')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ changePresell({date:JSON.stringify(arr),presell:this.form.presell,id:this.option.id}).then(res=>{
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ presellChangeFn(e){
|
|
|
|
|
+ this.form.presell = e.detail.value ? 1 : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.app-content {
|
|
|
|
|
+ min-height: calc(100vh - 20upx);
|
|
|
|
|
+ padding-top: 20upx;
|
|
|
|
|
+}
|
|
|
|
|
+.prompt-text {
|
|
|
|
|
+ color: $fontColor3;
|
|
|
|
|
+ padding-left: 30upx;
|
|
|
|
|
+ margin-bottom: 30upx;
|
|
|
|
|
+}
|
|
|
|
|
+.module-com {
|
|
|
|
|
+ margin-bottom: 20upx;
|
|
|
|
|
+ .member-wrap {
|
|
|
|
|
+ .member-det {
|
|
|
|
|
+ font-size: 24upx;
|
|
|
|
|
+ margin-left: 20upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .remark-wrap {
|
|
|
|
|
+ align-items: flex-start;
|
|
|
|
|
+ .remark {
|
|
|
|
|
+ height: 240upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.confirm-btn {
|
|
|
|
|
+ width: calc(100% - 60upx);
|
|
|
|
|
+ margin: 60upx 30upx 20upx;
|
|
|
|
|
+ .admin-button-com {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|