123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <!-- 订单列表2 -->
- <template>
- <u-navbar :is-back="false" title="订单查询"></u-navbar>
-
- <view class="order-list" v-if="state.list && state.list.length > 0">
- <view class="order-item" v-for="item in state.list">
- <orderListItemNew :item="item"></orderListItemNew>
- </view>
- <uni-load-more :status="state.status" iconType="snow" :icon-size="16" :content-text="state.contentTxt" v-if="state.list.length > 0" />
- </view>
-
- <NoDataView v-else></NoDataView>
-
- <FixedFooter>
- <button
- type="default"
- class="ui-btn"
- @click="searchShow">
- 查询
- </button>
- </FixedFooter>
-
- <!--填写手机号 start-->
- <u-popup v-model="state.inputPhonePopup" mode="center">
- <view class="input-phone">
- <view class="title">订单查询</view>
- <view class="tips">请输入手机号进行订单查询</view>
- <u-form ref="myForm">
- <view class="input-phone-from">
- <u-form-item prop="phone">
- <view class="from_item">
- <text><text style="color: red"></text>手机号:</text>
- <u-input v-model="phone" class="input" placeholder="请输出查询手机号"/>
- </view>
- </u-form-item>
- <!-- <u-form-item prop="code">
- <view class="from_item">
- <text><text style="color: red"></text>验证码:</text>
- <u-input v-model="code" placeholder="请输入验证码" class="input" />
- <view class="hint2">
- <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
- <view class="grey" @click="sendRegisterCode">{{ codeDuration === 0 ? "发送验证码" : "秒后可重发"
- }}</view>
- </view>
- </view>
- </u-form-item> -->
- </view>
- </u-form>
-
- <button type="default" class="ui-btn search-btn" @click="search">
- 查询
- </button>
- </view>
- </u-popup>
- <!--填写手机号 end-->
- </template>
-
- <script setup lang="ts">
- import { msg, navTo, confirm, checkStr } from "@/utils/utils";
- import orderTabbar from "./components/order-tabbar.vue";
- import orderListItem from "./components/order-list-item";
- import useOrderList from "@/composables/order/useOrderList";
- import filter from '@/components/filter/filter.vue';
- import {onUnload, onLoad} from '@dcloudio/uni-app'
- import { reactive } from "vue";
- import NoDataView from "@/components/no-data-view/no-data-view.vue";
- import orderListItemNew from "./components/order-list-item-new.vue";
- import { requestNew } from "@/utils/network/request";
- import { sendMessage, getChannleOrder} from "@/utils/network/api.js";
- import { ref } from "vue";
- import FixedFooter from '@/components/common/FixedFooter.vue'
-
- onLoad((option : any) => {
- console.log(option)
- })
-
- const state = reactive({
- list: [],
- status: 'nomore',
- contentTxt: {
- contentdown: '~上拉加载更多~',
- contentrefresh: '努力加载中...',
- contentnomore: '-- 我是有底线的 --'
- },
- inputPhonePopup: true
- });
-
- const getList = () => {
- let options = {
- type: 2,
- data: { mobile: phone.value },
- method: "POST",
- showLoading: true,
- }
- console.log(phone.value)
- requestNew(getChannleOrder, options).then((res) => {
- console.log(res)
- let list = res.orderList || []
- state.list = list
- if (list.length > 0) {
- state.inputPhonePopup = false
- } else {
- msg("该手机号暂无相关订单")
- }
- });
- }
-
- const search = () => {
- if (!phone.value) {
- msg("请输入手机号");
- return;
- } if (!checkStr(phone.value, 'mobile')) {
- msg("请输入正确的手机号");
- return;
- }
-
- getList();
- }
-
- const searchShow = () => {
- state.inputPhonePopup = true
- }
-
- //倒计时时常
- const codeDuration = ref(0);
- const phone = ref("");
- let interval = null;
-
- /* 验证码倒计时 */
- const codeInterval = () => {
- codeDuration.value = 60;
- interval = setInterval(() => {
- codeDuration.value--;
- if (codeDuration.value === 0) {
- if (interval) {
- clearInterval(interval);
- interval = null;
- }
- }
- }, 1000);
- };
-
- /* 发送验证码 */
- const sendRegisterCode = () => {
- if (codeDuration.value !== 0) {
- return;
- }
- const options = {
- type: 2,
- data: { mobile: phone.value },
- method: "POST",
- showLoading: true,
- };
- requestNew(sendMessage, options).then((res) => {
- msg("验证码发送成功!");
- codeInterval();
- });
- };
-
-
- </script>
-
- <style lang="scss">
- page {
- background: #E9EDF0;
- }
-
- :deep(.u-mode-center-box) {
- border-radius: 20rpx;
- }
- </style>
- <style lang="scss" scoped>
-
- .hint2 {
- margin-top: 40rpx;
- display: flex;
-
- .green {
- font-size: 28rpx;
- color: #00b38b;
- }
-
- .grey {
- font-size: 24rpx;
- color: #999999;
- margin-left: 16rpx;
- }
- }
- .input-phone{
- width: 600rpx;
- padding: 32rpx ;
- .title{
- padding: 12rpx 0;
- text-align: center;
- font-weight: bold;
- font-size: 32rpx;
- }
- .tips{
- color: #CCB375;
- font-size: 26rpx;
- line-height: 1.5;
- text-align: center;
- margin-bottom: 24rpx;
- }
- }
- .input-phone-from{
- padding: 12rpx 24rpx;
- background-color: #f7f7f7;
- border-radius: 12rpx;
- }
- .search-btn{
- width: 520rpx;
- margin: 32rpx auto 0;
- }
- </style>
|