Commit b0788fdd8d48884658703fd41f94a9660bf74794

Authored by lxf
1 parent aa109b61

fix: 货源

common/api.js
... ... @@ -184,6 +184,7 @@ module.exports = (vm) => {
184 184 cancelBidding: data => vm.$u.http.post( freightAPI + '/freightGoodsSourceV2/cancelBidding', data),
185 185 delete: data => vm.$u.http.post( freightAPI + '/freightGoodsSourceV2/delete', data),
186 186 buildMaQrcode: params => vm.$u.http.get( freightAPI + '/freightGoodsSourceV2/buildMaQrcode', {params}),
  187 + getLatestRemark: params => vm.$u.http.get( freightAPI + '/freightGoodsSourceV2/getHistoryRemark', params), // 使用的历史备注
187 188 }
188 189 };
189 190 }
... ...
pages.json
... ... @@ -28,6 +28,11 @@
28 28 "navigationBarTitleText": "创建货源"
29 29 }
30 30 },{
  31 + "path": "pages/goodSource/select-remark",
  32 + "style": {
  33 + "navigationBarTitleText": "填写备注"
  34 + }
  35 + },{
31 36 "path": "pages/goodSource/detail",
32 37 "style": {
33 38 "navigationBarTitleText": "飞牛货源详情",
... ...
pages/goodSource/add.vue
... ... @@ -74,8 +74,8 @@
74 74 </view>
75 75 <template v-if="more">
76 76 <view class="card">
77   - <u-form-item label="订单备注">
78   - <u-input v-model="form.remark" border="none" placeholder="请输入,选填" />
  77 + <u-form-item label="订单备注" @click="selectRemark">
  78 + <u-input v-model="form.remark" border="none" placeholder="请输入,选填" suffix-icon="arrow-right" disabledColor="#ffffff" disabled />
79 79 </u-form-item>
80 80 </view>
81 81 <view class="card">
... ... @@ -112,6 +112,16 @@
112 112 </view>
113 113 </view>
114 114 </tui-bottom-popup>
  115 + <u-picker
  116 + ref="picker"
  117 + :show="priceTypeVisible"
  118 + :columns="priceTypeColumns"
  119 + @confirm="priceTypeConfirm"
  120 + @cancel="priceTypeVisible = false"
  121 + key-name="valueName"
  122 + :default-index="[1]"
  123 + immediate-change
  124 + />
115 125 <u-toast ref="uToast"></u-toast>
116 126 </Page>
117 127 </template>
... ... @@ -124,6 +134,7 @@ export default {
124 134 data() {
125 135 return {
126 136 loading: false,
  137 + priceTypeVisible: false,
127 138 showLoadTime1: false,
128 139 showLoadTime2: false,
129 140 loadTimeDef1: new Date(),
... ... @@ -198,6 +209,9 @@ export default {
198 209 }
199 210 return res.join('/');
200 211 },
  212 + priceTypeColumns() {
  213 + return [this.dictList('FREIGHT_GOODS_SOURCE_PRICE_TYPE')];
  214 + },
201 215 },
202 216 onLoad(option) {
203 217 if (option.code) {
... ... @@ -242,15 +256,8 @@ export default {
242 256 }
243 257 });
244 258 },
245   - // selectRemark() {
246   - // uni.$once('select-remark', remark => {
247   - // this.form.remark = remark || '';
248   - // });
249   - // uni.navigateTo({
250   - // url: `/pages/order/select-remark`,
251   - // });
252   - // },
253 259 choseProjectCode() {
  260 + uni.$off('select-common');
254 261 uni.$once('select-common', option => {
255 262 this.form.projectCode = option.code;
256 263 this.form.projectName = option.name;
... ... @@ -294,19 +301,17 @@ export default {
294 301 }
295 302 this.form.specification = this.choseSpecificationList.join(',');
296 303 },
  304 + priceTypeConfirm(v) {
  305 + let option = v.value[0];
  306 + this.form.priceType = option.valueCode;
  307 + this.form.priceTypeName = option.valueName;
  308 + this.priceTypeVisible = false;
  309 + },
297 310 chosePriceType() {
298   - uni.$once('select-dict', option => {
299   - this.form.priceType = option.valueCode;
300   - this.form.priceTypeName = option.valueName;
301   - });
302   - uni.navigateTo({
303   - url: `/pages/global/search-dict${urlParam({
304   - title: '计价方式',
305   - dict: 'FREIGHT_GOODS_SOURCE_PRICE_TYPE',
306   - })}`,
307   - });
  311 + this.priceTypeVisible = true;
308 312 },
309 313 choseGoodsName() {
  314 + uni.$off('select-common');
310 315 uni.$once('select-common', option => {
311 316 this.form.goodsName = option.name;
312 317 });
... ... @@ -362,6 +367,14 @@ export default {
362 367 this.form.endTime = dayjs(value).format('YYYY-MM-DD HH:mm:ss');
363 368 this.showLoadTime2 = false;
364 369 },
  370 + selectRemark() {
  371 + uni.$once('select-remark', remark => {
  372 + this.form.remark = remark || '';
  373 + });
  374 + uni.navigateTo({
  375 + url: `/pages/goodSource/select-remark`,
  376 + });
  377 + },
365 378 submitAddFun() {
366 379 if (this.loading) return;
367 380 this.loading = true;
... ...
pages/goodSource/select-remark.vue 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +<template>
  2 + <Page name="select-remark" flank>
  3 + <template #content>
  4 + <u-textarea placeholder="请输入,点击历史备注快捷填写" v-model="remark"></u-textarea>
  5 + <view class="his-title">历史备注</view>
  6 + <view class="his-card">
  7 + <view @click="clickItem(item)" class="his-item" v-for="(item, index) in hisList" :key="index">
  8 + <text>{{ item }}</text>
  9 + </view>
  10 + </view>
  11 + </template>
  12 + <template #footer>
  13 + <u-button type="primary" @click="onSelect">确定</u-button>
  14 + </template>
  15 + </Page>
  16 +</template>
  17 +<script>
  18 +export default {
  19 + name: 'select-remark',
  20 + data() {
  21 + return {
  22 + remark: '',
  23 + hisList: [],
  24 + };
  25 + },
  26 + onLoad(option) {
  27 + this.remark = option.remark || '';
  28 + this.getHis();
  29 + },
  30 + methods: {
  31 + getHis() {
  32 + uni.$u.api.freightGoodsSourceV2.getLatestRemark({}).then(res => {
  33 + this.hisList = res.result || [];
  34 + });
  35 + },
  36 + clickItem(v) {
  37 + this.remark = v;
  38 + },
  39 + onSelect() {
  40 + uni.$emit('select-remark', this.remark);
  41 + uni.navigateBack();
  42 + },
  43 + },
  44 +};
  45 +</script>
  46 +
  47 +<style lang="scss">
  48 +.page-select-remark {
  49 + &__content {
  50 + .his-title {
  51 + padding: $padding-xs 0;
  52 + }
  53 + .his-card {
  54 + padding: $padding-md $padding-xs;
  55 + border-radius: $radius-md;
  56 + background: $color-white;
  57 + .his-item {
  58 + padding: $padding-xs 0;
  59 + color: $color-text-minor;
  60 + border-bottom: 1px solid $color-border;
  61 + text {
  62 + overflow-wrap: anywhere;
  63 + }
  64 + }
  65 + .his-item:last-child {
  66 + border-bottom: none;
  67 + }
  68 + }
  69 + }
  70 +}
  71 +</style>
... ...