| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <view>
- <!-- 正确使用 u-navbar 的具名插槽 -->
- <u-navbar :autoBack="true" :placeholder="true" v-hideNav>
- <template v-slot:center>
- <view class="slot-wrap">
- <text @click="handleBrandClick" class="brand">{{ topInfo.brand }}</text>
- <text class="divider">|</text>
- <text @click="handleModelClick" class="model">{{ topInfo.model }}</text>
- <text class="divider">|</text>
- <text @click="handlePriceClick" class="price">¥{{ topInfo.price }}</text>
- </view>
- </template>
- <template v-slot:right>
- <view class="slot-right" @click="handleAddClick">
- <image src="/static/icons/plus.png" mode="scaleToFill" />
- <text>加一单</text>
- </view>
- </template>
- </u-navbar>
- <orderDetailNewView :detail="receiptDetail" :topInfo="topInfo" :orderId="orderId" />
- <!-- 通用模态窗 -->
- <custom-modal :visible="modalVisible" :title="modalConfig.title" :value="modalConfig.value"
- :placeholder="modalConfig.placeholder" @cancel="handleModalCancel" @confirm="handleModalConfirm" />
- </view>
- </template>
- <script>
- import orderDetailNewView from './components/orderDetailNewView.vue'
- import CustomModal from './components/CustomModal.vue'
- export default {
- name: 'CustomNavbar',
- components: {
- orderDetailNewView,
- CustomModal
- },
- data() {
- return {
- topInfo: {
- brand: 'Hermes',
- model: 'Birkin 30',
- price: '125,000'
- },
- modalVisible: false,
- currentEditField: '',
- modalConfig: {
- title: '',
- value: '',
- placeholder: ''
- },
- item: '',
- orderId: '',
- type: '',
- clueId: '',
- // 订单详情
- receiptDetail: {},
- }
- },
- onLoad(option) {
- // 接收参数
- const { item, orderId, type, clueId } = option;
- console.log('接收的参数:', option);
- this.item = item;
- this.orderId = orderId;
- this.type = type;
- this.clueId = clueId;
- //查询订单详情
- this.getOrderDetail();
- },
- methods: {
- handleBrandClick() {
- this.openModal('brand', '请输入品牌', this.topInfo.brand, '请输入品牌')
- },
- handleModelClick() {
- this.openModal('model', '请输入型号', this.topInfo.model, '请输入型号')
- },
- handlePriceClick() {
- this.openModal('price', '请输入价格', this.topInfo.price, '请输入价格')
- },
- openModal(field, title, value, placeholder) {
- this.currentEditField = field
- this.modalConfig = {
- title,
- value,
- placeholder
- }
- this.modalVisible = true
- },
- handleModalInput(value) {
- this.modalConfig.value = value
- },
- handleModalCancel() {
- this.modalVisible = false
- this.currentEditField = ''
- },
- handleModalConfirm(newValue) {
- if (this.currentEditField) {
- this.topInfo[this.currentEditField] = newValue
- }
- this.modalVisible = false
- this.currentEditField = ''
- },
- handleAddClick() {
- console.log('加一单')
- },
- //查询订单详情
- async getOrderDetail() {
- const res = await uni.$u.api
- .getClueSendFormVoByOrderId({
- id: this.orderId,
- })
- console.log('订单详情', res);
- if (res.code === 200) {
- this.receiptDetail = res.data;
- }
- }
- }
- }
- </script>
- <style scoped>
- .slot-wrap {
- display: flex;
- align-items: center;
- background-color: #fff;
- border-radius: 40rpx;
- padding: 10rpx 20rpx;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
- }
- .brand {
- font-weight: bold;
- color: #333;
- font-size: 28rpx;
- }
- .divider {
- margin: 0 15rpx;
- color: #ddd;
- font-size: 28rpx;
- }
- .model {
- color: #666;
- font-size: 26rpx;
- }
- .price {
- color: blueviolet;
- font-weight: bold;
- font-size: 28rpx;
- }
- .slot-right {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: 20rpx;
- color: blueviolet;
- image {
- width: 30rpx;
- height: 30rpx;
- }
- }
- </style>
|