HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/dk/wp-content/themes/food/food-app/page-ranking_activity_input.php
<?php
/* Template Name: ranking_activity_input */
//get_header('header-MedicalMediaChannel.php');
get_header('MedicalMediaChannel');

$user = wp_get_current_user();
$uid = $user->ID;
if (!empty($uid) && $uid > 0) {
} else {
    header("Location: /");
}
?>

<style>
    #app_form input {
        background-color: #1DBAFF;
    }

    .menu_a_div a:hover {
        color: #FAEE00;
    }
</style>
<app id="app">
    <yq-header></yq-header>

    <main class=" py-[0.2rem] md:w-[768px] md:mx-auto xl:w-[1280px]" style="min-height: 100%">

        <div class=" px-[0.3rem] flex items-center font-f-arial text-[0.18rem] leading-[0.20rem] text-333">
            <a href="/">首頁</a>
            <div class=" mx-[0.1rem]">></div>
            <a href="/mmc-user">用戶相關</a>
        </div>

        <div id="app_form" class=" mt-[0.2rem] w-full px-[0.3rem]">
            <div class=" flex items-center md:justify-start text-[0.2rem] leading-[0.2rem] ">
                <div @click="changeNav(0)" :class="active_nav == 1?'text-white bg-main':' bg-white text-333'"
                     class=" cursor-pointer w-[1.6rem] h-[0.48rem] rounded-[0.04rem] flex items-center justify-center">
                    用戶信息
                </div>
                <div @click="changeNav(1)" :class="active_nav == 0?'text-white bg-main':' bg-white text-333'"
                     class=" cursor-pointer w-[1.6rem] h-[0.48rem] rounded-[0.04rem] flex items-center justify-center">
                    訂單情況
                </div>
            </div>
            <div class=" w-full h-[0.02rem] mt-[0.04rem] bg-main rounded-[0.04rem]"></div>
            <div class=" w-full mt-[0.1rem]">
                <!-- 訂單情況 -->
                <div v-show="active_nav == 1" class=" w-full bg-white flex flex-col">
                    <div class=" text-[0.24rem] leading-[0.24rem] text-333 mb-[0.1rem]">
                        {{ user_order.length == 0?"-- 暫無訂單信息 --": "" }}
                    </div>
                    <a-collapse v-if="user_order.length > 0" v-model="activeKey">
                        <a-collapse-panel v-for="item in user_order" :key="'order'+item.ID">
                            <div slot="header" class=" flex items-center">
                                <div>#{{item.ID}} {{item.date}}</div>
                                <a v-if="item.status=='待支付'" @click="show_pay(item)"
                                   class=" text-F70500 ml-auto">{{item.status}} >></a>
                                <div v-else class=" ml-auto">{{item.status}}</div>
                            </div>
                            <div v-for="(item2, key) in item.products" :key="key"
                                 class=" cursor-pointer flex bg-white">
                                <div class=" ml-[0.2rem]">
                                    <img class=" bg-f5 w-[1.6rem] h-[1.6rem]" :src="item2.img_url"/>
                                </div>
                                <div class=" ml-[0.2rem]">
                                    <a :href="'/products_detail?id='+item2.id"
                                       class=" w-full overflow-ellipsis-2 text-333 text-[0.24rem] leading-[0.32rem]">
                                        {{item2.product_name}} x {{item2.quantity}}
                                    </a>
                                    <div class=" mt-[0.3rem] text-[0.36rem] leading-[0.32rem] font-f-din text-333">
                                        $ {{item2.product_price}}
                                    </div>
                                </div>
                            </div>
                            <div class=" flex items-center">
                                <div class=" text-333 ml-auto">合計:</div>
                                <div class=" ml-[0.1rem] text-F70500 text-[0.28rem] leading-[0.28rem]">$
                                    {{item.total}}
                                </div>
                            </div>
                        </a-collapse-panel>
                    </a-collapse>
                </div>
                <!-- 用戶信息 -->
                <div v-show="active_nav == 0" class=" w-full">
                    <div class=" w-full max-w-[600px] flex flex-col text-[0.24rem] leading-[0.24rem] text-333">
                        <div class=" mt-[0.1rem] flex items-center">
                            <div class=" w-[1.6rem] flex-shrink-0">
                                用戶名稱 *
                            </div>
                            <div class=" flex flex-col flex-1">
                                <div class=" flex items-center mb-[0.1rem] w-full p-[0.2rem] border-[0.03rem] rounded-[4px]">
                                    <input class=" outline-none w-full" type="text"
                                           v-model="user_setting_info.user_nicename">
                                </div>
                            </div>
                        </div>
                        <div class=" mt-[0.1rem] flex items-center">
                            <div class=" w-[1.6rem] flex-shrink-0">
                                聯繫電話 *
                            </div>
                            <div class=" flex flex-col flex-1">
                                <div class=" flex items-center mb-[0.1rem] w-full p-[0.2rem] border-[0.03rem] rounded-[4px]">
                                    <input class=" outline-none w-full" type="text"
                                           v-model="user_setting_info.user_phone">
                                </div>
                            </div>
                        </div>
                        <div class=" mt-[0.1rem] flex items-center">
                            <div class=" w-[1.6rem] flex-shrink-0">
                                聯繫郵箱 *
                            </div>
                            <div class=" flex flex-col flex-1">
                                <div class=" flex items-center mb-[0.1rem] w-full p-[0.2rem] border-[0.03rem] rounded-[4px]">
                                    <input class=" outline-none w-full" type="text"
                                           v-model="user_setting_info.user_email">
                                </div>
                            </div>
                        </div>
                        <div class=" mt-[0.1rem] flex">
                            <div class=" w-[1.6rem] flex-shrink-0 mt-[0.25rem]">
                                收貨地址 *
                            </div>
                            <div class=" flex flex-col flex-1">
                                <div v-for="(item, key) in user_setting_info.user_address" :key="key" :title="item"
                                     :class="user_setting_info.address_current != key?'border-f5':'border-main'"
                                     class=" flex items-center mb-[0.1rem] w-full p-[0.2rem] border-[0.03rem] rounded-[4px]">
                                    <input class=" outline-none w-full" type="text"
                                           v-model="user_setting_info.user_address[key]">
                                    <a-radio @click="user_setting_info.address_current = key"
                                             :checked="user_setting_info.address_current == key"></a-radio>
                                </div>
                            </div>
                        </div>

                        <div class=" mt-[0.2rem] items-center flex">
                            <div @click="saveSetting"
                                 class=" cursor-pointer w-[2.56rem] h-[0.64rem] flex items-center justify-center rounded-[0.02rem] bg-main text-white text-[0.22rem] leading-[0.22rem] font-medium">
                                保存
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class=" mx-[0.3rem] flex items-center mt-[0.6rem]">
            <div class=" text-[0.24rem] font-medium leading-[0.24rem] text-333">猜你喜歡</div>
            <a href="/products_search" class=" cursor-pointer ml-auto text-[0.2rem] leading-[0.2rem] text-white">更多
                >></a>
        </div>

        <yq-products-list-three :list="product_list_date" class=" mt-[0.2rem]"></yq-products-list-three>
    </main>

    <yq-pay-model ref="pay_model" :moneny="tmp_total" @create_order_pay="pay_order"
                  @create_order_padding="() => {}"></yq-pay-model>

    <yq-footer></yq-footer>
</app>

<script>
    const local_url = '<?php echo $local_url ?>'
    new Vue({
        el: "#app",
        components: {
            //'yq-header': httpVueLoader('<?php //showFoodAppPath('components/yq-header.vue?v=5') ?>//'),
            //'yq-footer': httpVueLoader('<?php //showFoodAppPath('components/yq-footer.vue?v=2') ?>//'),
            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header-MMC.vue?v=' . time()) ?>'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer-MMC.vue?v=' . time()) ?>'),

            'yq-products-list-three': httpVueLoader('<?php showFoodAppPath('components/yq-products-list-three.vue?v=1') ?>'),
            //'yq-food-list-three': httpVueLoader('<?php //showFoodAppPath('components/yq-food-list-three.vue?v=1') ?>//'),
            'yq-pay-model': httpVueLoader('<?php showFoodAppPath('components/yq-pay-model.vue?v=3') ?>'),
        },
        data: {
            active_nav: 0,
            activeKey: [],
            user_setting_info: {
                user_nicename: '',
                user_phone: '',
                user_email: '',
                user_address: {
                    address1: '',
                    address2: '',
                    address3: '',
                    address4: '',
                },
                address_current: 'address1'
            },
            product_list_date: [],
            loading: false,
            user_order: [],
            tmp_total: '0',
            tmp_id: '0'
        },
        created() {
            this.get_product_list_date()
            this.get_user_setting()
            this.get_user_order()

            if (sessionStorage.user_active_nav) {
                this.active_nav = sessionStorage.user_active_nav
            }
        },
        methods: {
            moment,
            show_pay(item) {
                this.tmp_total = item.total
                this.tmp_id = item.ID

                this.$refs.pay_model.changeShow()
            },
            async pay_order(file) {
                let param = new FormData()

                param.append('pay_file', file)
                param.append('order_id', this.tmp_id)
                param.append('module', 'order')
                param.append('action', 'pay_order')

                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: param
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.get_user_order()
                        antd.message.success('支付成功,訂單處理中');
                    } else if (data.rc == 2) {
                        this.get_user_order()
                        antd.message.error('上傳失敗,請重新上傳');
                    }
                }
            },
            async saveSetting() {
                if (this.loading) {
                    return false
                }

                if (
                    this.user_setting_info.user_nicename == '' ||
                    this.user_setting_info.user_phone == '' ||
                    this.user_setting_info.user_email == '' ||
                    this.user_setting_info.user_address[this.user_setting_info.address_current] == ''
                ) {
                    antd.message.info('請檢查必填內容');
                    return false
                }
                this.loading = true
                const hide = antd.message.loading('更新中...');

                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'user',
                        action: 'u_user_setting',
                        ...this.user_setting_info
                    })
                });

                hide();
                this.loading = false
                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        antd.message.success('更新成功');
                        this.get_user_setting()
                    } else {
                        antd.message.info('更新失敗');
                    }
                }
            },
            async get_user_setting() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'user',
                        action: 'r_user_setting'
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.user_setting_info = data.res
                    }
                }
            },
            async get_user_order() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'order',
                        action: 'r_user_order'
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.user_order = data.res
                        if (this.user_order.length > 0) {
                            this.activeKey = 'order' + this.user_order[0].ID
                        }
                    }
                }
            },
            async get_product_list_date() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_date',
                        limit: 6
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.product_list_date = data.res
                    }
                }
            },
            changeNav(key) {
                this.active_nav = key
                sessionStorage.user_active_nav = key
            }
        }
    })
</script>

<?php //get_footer('footer-food.php'); ?>
<?php get_footer('food'); ?>