| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <view class="container">
- <!-- 底部按钮 -->
- <view class="footer">
- <!-- 查询区域 -->
- <view class="query-section">
- <u-radio-group v-model="formData.searchType">
- <u-radio label="查订单" name="1" labelSize="16px" iconSize="16px" />
- <u-radio label="查物流" custom-style="margin-left:20px" name="2" labelSize="16px" iconSize="16px" />
- </u-radio-group>
- <view class="search-box">
- <u-input custom-style="font-size:32rpx" placeholder-style="fong-size:32rpx" v-model="formData.search"
- :placeholder="formData.searchType == '1' ? '扫描/输入订单号' : '扫描/输入物流单号'" border="surround"
- clearable>
- </u-input>
- <u-button color="#c8c8c8" text="查询" @click="handleSubmit" />
- </view>
- </view>
- <u-divider></u-divider>
- <view style="display: flex;">
- <u-button size="large" type="success" text="确认收货扫码" @click="handleScan" />
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue';
- import {
- onLoad
- } from '@dcloudio/uni-app';
- const formData = ref({
- searchType: '2',
- search: '',
- });
- const searchKeyword = ref('');
- // 处理查询
- const handleSubmit = () => {
- console.log('查询:', searchKeyword.value);
- if(!formData.value.search){
- uni.$u.toast('请扫描/输入物流单号')
- return
- }
- uni.$u.http.post('/app/orderinfo/confirmOrder', formData.value).then(res => {
- console.log(res)
- if (res.code == 200) {
- let text = code + '收货成功'
- uni.$u.ttsModule.speak(text)
- } else {
- let text = code + '订单不存在'
- uni.$u.ttsModule.speak(text)
- }
- })
- };
- // 处理扫码
- const handleScan = () => {
- uni.scanCode({
- success: (res) => {
- formData.value.search = res.result;
- handleSubmit();
- }
- });
- };
- onLoad(() => {
- // #ifdef APP-PLUS
- uni.$u.useGlobalEvent((e) => {
- formData.value.search = e.barcode
- handleSubmit()
- })
- // #endif
- })
- </script>
- <style lang="scss" scoped>
- @import '../components/common.scss';
- </style>
|