You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

channel.vue 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <!-- 订单列表2 -->
  2. <template>
  3. <view class="as-layout-horizontal as-gravity-center-start search-layout">
  4. <view class="search-box">
  5. <image :src="`${$imgUrl}service/icon-search.png`" class="icon" mode="aspectFill"></image>
  6. <view class="column-input" @click="showSearch">
  7. <text class="column-value" v-if="phone">{{ phone }}</text>
  8. <text class="column-placeholder" v-else>请输入手机号</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="order-list" v-if="state.list && state.list.length > 0">
  13. <view class="order-item" v-for="item in state.list">
  14. <orderListItemNew :item="item"></orderListItemNew>
  15. </view>
  16. <uni-load-more :status="state.status" iconType="snow" :icon-size="16" :content-text="state.contentTxt" v-if="state.list.length > 0" />
  17. </view>
  18. <NoDataView v-else style="margin-top: 34rpx;"></NoDataView>
  19. <!-- <FixedFooter>
  20. <button
  21. type="default"
  22. class="ui-btn"
  23. @click="searchShow">
  24. 查询
  25. </button>
  26. </FixedFooter> -->
  27. <!--填写手机号 start-->
  28. <u-popup v-model="state.inputPhonePopup" mode="center" @close="popupClose">
  29. <view class="input-phone">
  30. <view class="title">订单查询</view>
  31. <view class="tips">请输入手机号进行订单查询</view>
  32. <u-form ref="myForm">
  33. <view class="input-phone-from">
  34. <u-form-item prop="phone">
  35. <view class="from_item">
  36. <!-- <text><text style="color: red"></text>手机号:</text> -->
  37. <u-input v-model="phone" class="input" placeholder="请输出查询手机号" :focus="state.isFocus"/>
  38. </view>
  39. </u-form-item>
  40. <!-- <u-form-item prop="code">
  41. <view class="from_item">
  42. <text><text style="color: red"></text>验证码:</text>
  43. <u-input v-model="code" placeholder="请输入验证码" class="input" />
  44. <view class="hint2">
  45. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  46. <view class="grey" @click="sendRegisterCode">{{ codeDuration === 0 ? "发送验证码" : "秒后可重发"
  47. }}</view>
  48. </view>
  49. </view>
  50. </u-form-item> -->
  51. </view>
  52. </u-form>
  53. <button type="default" class="ui-btn search-btn" @click="search">
  54. 查询
  55. </button>
  56. </view>
  57. </u-popup>
  58. <!--填写手机号 end-->
  59. </template>
  60. <script setup lang="ts">
  61. import { msg, navTo, confirm, checkStr } from "@/utils/utils";
  62. import orderTabbar from "./components/order-tabbar.vue";
  63. import orderListItem from "./components/order-list-item";
  64. import useOrderList from "@/composables/order/useOrderList";
  65. import filter from '@/components/filter/filter.vue';
  66. import {onUnload, onLoad} from '@dcloudio/uni-app'
  67. import { reactive } from "vue";
  68. import NoDataView from "@/components/no-data-view/no-data-view.vue";
  69. import orderListItemNew from "./components/order-list-item-new.vue";
  70. import { requestNew } from "@/utils/network/request";
  71. import { sendMessage, getChannleOrder} from "@/utils/network/api.js";
  72. import { ref } from "vue";
  73. import FixedFooter from '@/components/common/FixedFooter.vue'
  74. onLoad((option : any) => {
  75. console.log(option)
  76. })
  77. const state = reactive({
  78. list: [],
  79. status: 'nomore',
  80. contentTxt: {
  81. contentdown: '~上拉加载更多~',
  82. contentrefresh: '努力加载中...',
  83. contentnomore: '-- 我是有底线的 --'
  84. },
  85. inputPhonePopup: true,
  86. isFocus: false
  87. });
  88. const getList = () => {
  89. let options = {
  90. type: 2,
  91. data: { mobile: phone.value },
  92. method: "POST",
  93. showLoading: true,
  94. }
  95. console.log(phone.value)
  96. requestNew(getChannleOrder, options).then((res) => {
  97. console.log(res)
  98. let list = res.orderList || []
  99. state.list = list
  100. if (list.length > 0) {
  101. state.inputPhonePopup = false
  102. } else {
  103. msg("该手机号暂无相关订单")
  104. }
  105. });
  106. }
  107. const search = () => {
  108. if (!phone.value) {
  109. msg("请输入手机号");
  110. return;
  111. } if (!checkStr(phone.value, 'mobile')) {
  112. msg("请输入正确的手机号");
  113. return;
  114. }
  115. getList();
  116. }
  117. const showSearch = () => {
  118. state.inputPhonePopup = true
  119. state.isFocus = true
  120. console.log(state.isFocus)
  121. }
  122. const searchShow = () => {
  123. state.inputPhonePopup = true
  124. }
  125. const popupClose = () => {
  126. state.isFocus = false
  127. }
  128. //倒计时时常
  129. const codeDuration = ref(0);
  130. const phone = ref("");
  131. let interval = null;
  132. /* 验证码倒计时 */
  133. const codeInterval = () => {
  134. codeDuration.value = 60;
  135. interval = setInterval(() => {
  136. codeDuration.value--;
  137. if (codeDuration.value === 0) {
  138. if (interval) {
  139. clearInterval(interval);
  140. interval = null;
  141. }
  142. }
  143. }, 1000);
  144. };
  145. /* 发送验证码 */
  146. const sendRegisterCode = () => {
  147. if (codeDuration.value !== 0) {
  148. return;
  149. }
  150. const options = {
  151. type: 2,
  152. data: { mobile: phone.value },
  153. method: "POST",
  154. showLoading: true,
  155. };
  156. requestNew(sendMessage, options).then((res) => {
  157. msg("验证码发送成功!");
  158. codeInterval();
  159. });
  160. };
  161. </script>
  162. <style lang="scss">
  163. page {
  164. background: #E9EDF0;
  165. }
  166. :deep(.u-mode-center-box) {
  167. border-radius: 20rpx;
  168. }
  169. </style>
  170. <style lang="scss" scoped>
  171. .hint2 {
  172. margin-top: 40rpx;
  173. display: flex;
  174. .green {
  175. font-size: 28rpx;
  176. color: #00b38b;
  177. }
  178. .grey {
  179. font-size: 24rpx;
  180. color: #999999;
  181. margin-left: 16rpx;
  182. }
  183. }
  184. .input-phone{
  185. width: 600rpx;
  186. padding: 32rpx ;
  187. .title{
  188. padding: 12rpx 0;
  189. text-align: center;
  190. font-weight: bold;
  191. font-size: 32rpx;
  192. }
  193. .tips{
  194. color: #CCB375;
  195. font-size: 26rpx;
  196. line-height: 1.5;
  197. text-align: center;
  198. margin-bottom: 24rpx;
  199. }
  200. }
  201. .input-phone-from{
  202. padding: 12rpx 24rpx;
  203. background-color: #f7f7f7;
  204. border-radius: 12rpx;
  205. }
  206. .search-btn{
  207. width: 520rpx;
  208. margin: 32rpx auto 0;
  209. }
  210. .toggle-phone{
  211. margin: 20rpx 30rpx;
  212. padding: 18rpx 30rpx 18px;
  213. background: linear-gradient(to right, #CCB375 0%, #E7D398 100%);
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. color: #FFFFFF;
  218. border-radius: 12rpx;
  219. }
  220. .search-layout {
  221. .search-box {
  222. margin: 30rpx 30rpx 0rpx 30rpx;
  223. height: 80rpx;
  224. background: #FFFFFF;
  225. border: 1px solid #DCDCDC;
  226. border-radius: 40rpx;
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. box-sizing: border-box;
  231. flex: 1;
  232. }
  233. .search-box .icon {
  234. width: 48rpx;
  235. height: 48rpx;
  236. margin: 0 20rpx;
  237. }
  238. .search-box .search {
  239. flex: 1;
  240. margin-right: 20rpx;
  241. height: 100%;
  242. padding: 0 10rpx;
  243. font-size: 28rpx;
  244. color: #00b38b;
  245. }
  246. .search-btn {
  247. color: white;
  248. background-color: #00B38B;
  249. width: 140rpx;
  250. height: 75rpx;
  251. line-height: 75rpx;
  252. font-size: 32rpx;
  253. border-radius: 40rpx;
  254. text-align: center;
  255. margin-right: 30rpx;
  256. margin-top: 30rpx;
  257. }
  258. .column-input{
  259. flex: 1;
  260. font-size: 28rpx;
  261. color: #333333;
  262. }
  263. .column-placeholder{
  264. color: #c0c4cc;
  265. }
  266. }
  267. </style>