|
|
@@ -11,7 +11,11 @@
|
|
|
v-for="(item, index) in selectList"
|
|
|
:key="index"
|
|
|
>
|
|
|
- <image class="item-icon" :src="item.cover" alt="商品图" />
|
|
|
+ <image
|
|
|
+ class="item-icon"
|
|
|
+ :src="item.itemCover || item.cover"
|
|
|
+ alt="商品图"
|
|
|
+ />
|
|
|
|
|
|
<view class="item-info">
|
|
|
<view class="info-line">
|
|
|
@@ -19,7 +23,9 @@
|
|
|
<text class="item-price">
|
|
|
<text class="unit">¥</text>
|
|
|
|
|
|
- <text class="price">{{ getSelectItemPrice(item) }}</text>
|
|
|
+ <text class="price">{{
|
|
|
+ item.itemPrice || getSelectItemPrice(item)
|
|
|
+ }}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
<view class="info-line">
|
|
|
@@ -51,13 +57,14 @@
|
|
|
<!-- <view class="prompt-text">注: 请先关注公众号,绑定后可以在移动端自动登录</view> -->
|
|
|
|
|
|
<view class="module-com input-line-wrap">
|
|
|
- <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
<view class="tui-title ">供应商</view>
|
|
|
<text>
|
|
|
- 茗星花卉 欠款:91658.00
|
|
|
+ {{ detailsInfo.supplierName || "" }}
|
|
|
+ <!-- 欠款:91658.00 -->
|
|
|
</text>
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <!-- <tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title "></view>
|
|
|
|
|
|
<view class="tag-list">
|
|
|
@@ -71,24 +78,36 @@
|
|
|
盛丰
|
|
|
</view>
|
|
|
</view>
|
|
|
- </tui-list-cell>
|
|
|
+ </tui-list-cell> -->
|
|
|
</view>
|
|
|
<view class="module-com input-line-wrap">
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title ">打包费</view>
|
|
|
<input
|
|
|
- v-model="form.floor"
|
|
|
+ :disabled="!canIEdit"
|
|
|
+ v-model="form.packingCharge"
|
|
|
+ placeholder-class="phcolor"
|
|
|
+ class="tui-input"
|
|
|
+ name="floor"
|
|
|
+ placeholder="请填写,留空没有费用"
|
|
|
+ />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title ">短途运费</view>
|
|
|
+ <input
|
|
|
+ :disabled="!canIEdit"
|
|
|
+ v-model="form.shortCharge"
|
|
|
placeholder-class="phcolor"
|
|
|
class="tui-input"
|
|
|
name="floor"
|
|
|
placeholder="请填写,留空没有费用"
|
|
|
/>
|
|
|
</tui-list-cell>
|
|
|
-
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title ">包机(长途运费)</view>
|
|
|
<input
|
|
|
- v-model="form.floor"
|
|
|
+ :disabled="!canIEdit"
|
|
|
+ v-model="form.longCharge"
|
|
|
placeholder-class="phcolor"
|
|
|
class="tui-input"
|
|
|
name="floor"
|
|
|
@@ -98,7 +117,8 @@
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title ">提货费</view>
|
|
|
<input
|
|
|
- v-model="form.floor"
|
|
|
+ :disabled="!canIEdit"
|
|
|
+ v-model="form.pickCharge"
|
|
|
placeholder-class="phcolor"
|
|
|
class="tui-input"
|
|
|
name="floor"
|
|
|
@@ -108,51 +128,41 @@
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
<view class="tui-title ">本地运费</view>
|
|
|
<input
|
|
|
- v-model="form.floor"
|
|
|
+ :disabled="!canIEdit"
|
|
|
+ v-model="form.localCharge"
|
|
|
placeholder-class="phcolor"
|
|
|
class="tui-input"
|
|
|
name="floor"
|
|
|
placeholder="请填写,留空没有费用"
|
|
|
/>
|
|
|
</tui-list-cell>
|
|
|
- <tui-list-cell
|
|
|
- class="line-cell"
|
|
|
- :hover="false"
|
|
|
- :arrow="true"
|
|
|
- @click="openAddres"
|
|
|
- >
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
<view class="tui-title ">入库日期</view>
|
|
|
- <view class="tui-input" v-if="form.province || form.city">
|
|
|
+ <!-- <view class="tui-input" v-if="form.province || form.city">
|
|
|
{{ form.province + "-" + form.city }}
|
|
|
- </view>
|
|
|
- <view class="tui-placeholder" v-else>请选择</view>
|
|
|
- <input v-model="form.province" name="province" hidden />
|
|
|
- </tui-list-cell>
|
|
|
- <tui-list-cell
|
|
|
- class="line-cell"
|
|
|
- :hover="false"
|
|
|
- :arrow="true"
|
|
|
- @click="openAddres"
|
|
|
- >
|
|
|
- <view class="tui-title ">仓库</view>
|
|
|
- <view class="tui-input" v-if="form.province || form.city">
|
|
|
- {{ form.province + "-" + form.city }}
|
|
|
- </view>
|
|
|
- <view class="tui-placeholder" v-else>请选择仓库</view>
|
|
|
- <input v-model="form.province" name="province" hidden />
|
|
|
+ </view> -->
|
|
|
+ <!-- <view class="tui-placeholder" v-else>请选择</view>
|
|
|
+ <input v-model="form.province" name="province" hidden /> -->
|
|
|
+ <AppDatePicker
|
|
|
+ v-if="canIEdit"
|
|
|
+ :dateVal="form.entryTime"
|
|
|
+ :placeholder="'请选择日期'"
|
|
|
+ />
|
|
|
+ <view v-else>{{ form.entryTime || "" }}</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <!-- <tui-list-cell class="line-cell remark-wrap" :hover="false">
|
|
|
- <view class="tui-title">简介</view>
|
|
|
+ <tui-list-cell class="line-cell remark-wrap" :hover="false">
|
|
|
+ <view class="tui-title">备注</view>
|
|
|
<view class="tui-input">
|
|
|
<textarea
|
|
|
+ :disabled="!canIEdit"
|
|
|
v-model="form.introduction"
|
|
|
class="tui-textarea remark"
|
|
|
placeholder-class="phcolor"
|
|
|
- placeholder="请输入简介"
|
|
|
+ placeholder="请输入备注"
|
|
|
/>
|
|
|
</view>
|
|
|
- </tui-list-cell> -->
|
|
|
+ </tui-list-cell>
|
|
|
</view>
|
|
|
</form>
|
|
|
</view>
|
|
|
@@ -163,22 +173,15 @@
|
|
|
¥ <text class="large">{{ allPrice }}</text>
|
|
|
</text>
|
|
|
</view>
|
|
|
- <button class="admin-button-com blue middle" @click="formSubmit">
|
|
|
+ <button
|
|
|
+ class="admin-button-com blue middle"
|
|
|
+ v-if="canIEdit"
|
|
|
+ @click="formSubmit"
|
|
|
+ >
|
|
|
确认
|
|
|
</button>
|
|
|
</view>
|
|
|
- <!-- 选择地区 -->
|
|
|
- <app-area-sel
|
|
|
- :show.sync="showRegion"
|
|
|
- @change="changeAreaFn"
|
|
|
- :city="form.city"
|
|
|
- />
|
|
|
- <!-- 省市联动 -->
|
|
|
- <simple-address
|
|
|
- ref="simpleAddress"
|
|
|
- :pickerValueDefault="cityPickerValueDefault"
|
|
|
- @onConfirm="onCityConfirm"
|
|
|
- ></simple-address>
|
|
|
+
|
|
|
<!-- 选择客户 -->
|
|
|
<AppCustomerSel
|
|
|
:show.sync="showCustomer"
|
|
|
@@ -189,53 +192,79 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { mapGetters, mapActions } from "vuex";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
-import SimpleAddress from "@/components/plugin/simple-address";
|
|
|
-import AppAreaSel from "@/components/app-area-sel";
|
|
|
import AppCustomerSel from "@/components/app-customer-sel";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import productMins from "@/mixins/product";
|
|
|
+import {
|
|
|
+ getPurchaseDetailApi,
|
|
|
+ createPurchaseOrderApi
|
|
|
+} from "@/api/purchase/index";
|
|
|
+import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
|
|
|
+
|
|
|
+import AppDatePicker from "@/components/app-date-picker";
|
|
|
|
|
|
export default {
|
|
|
// 采购详情
|
|
|
components: {
|
|
|
TuiListCell,
|
|
|
AppAvatarModule,
|
|
|
- SimpleAddress,
|
|
|
- AppAreaSel,
|
|
|
- AppCustomerSel
|
|
|
+ AppCustomerSel,
|
|
|
+ AppDatePicker
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
data() {
|
|
|
return {
|
|
|
+ PURCHASE_ORDER_STATUS,
|
|
|
autoLoad: false,
|
|
|
pageType: "purchase",
|
|
|
|
|
|
form: {
|
|
|
- shopName: "",
|
|
|
- province: "",
|
|
|
- city: "",
|
|
|
- address: "",
|
|
|
- floor: "",
|
|
|
- openTime: "8:00 - 22:00",
|
|
|
- introduction: "",
|
|
|
- telephone: "",
|
|
|
- customer: ""
|
|
|
+ packingCharge: "", //打包费
|
|
|
+ shortCharge: "",
|
|
|
+ longCharge: "",
|
|
|
+ pickCharge: "",
|
|
|
+ localCharge: "",
|
|
|
+
|
|
|
+ entryTime: "",
|
|
|
+ supplierId: null
|
|
|
},
|
|
|
- // 详细地址
|
|
|
- showRegion: false,
|
|
|
showCustomer: false,
|
|
|
- region: {
|
|
|
- lat: 0,
|
|
|
- long: 0
|
|
|
- },
|
|
|
- // 省市联动
|
|
|
- regionData: [],
|
|
|
- cityPickerValueDefault: [0, 0]
|
|
|
+ detailsInfo: {}
|
|
|
};
|
|
|
},
|
|
|
+ onLoad() {
|
|
|
+ this.initData();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["getMerchantInfo", "getLoginInfo"]),
|
|
|
+ allPrice() {
|
|
|
+ let price = 0;
|
|
|
+
|
|
|
+ if (this.selectList) {
|
|
|
+ for (const item of this.selectList) {
|
|
|
+ if (item.itemPrice) {
|
|
|
+ price += Number(item.itemPrice);
|
|
|
+ } else {
|
|
|
+ price += this.getSelectItemPrice(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Math.round(price * 100) / 100;
|
|
|
+ },
|
|
|
+ canIEdit() {
|
|
|
+ const { orderSn } = this.option || {};
|
|
|
+
|
|
|
+ if (!orderSn || this.detailsInfo.status == PURCHASE_ORDER_STATUS.CONFIRM) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ ...mapActions(["initMerchantInfo"]),
|
|
|
init() {
|
|
|
this._getDet();
|
|
|
},
|
|
|
@@ -249,88 +278,95 @@ export default {
|
|
|
// }
|
|
|
});
|
|
|
},
|
|
|
- // option
|
|
|
- // 选择地址
|
|
|
- selRegionFn() {
|
|
|
- if (!this.form.city) {
|
|
|
- this.$msg("请先选择城市!");
|
|
|
- return false;
|
|
|
+
|
|
|
+ async initData() {
|
|
|
+ try {
|
|
|
+ const { orderSn } = this.option;
|
|
|
+ if (!orderSn) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const { data } = await getPurchaseDetailApi(orderSn);
|
|
|
+ console.log(11111, data);
|
|
|
+ Object.keys(this.form).forEach((i, index) => {
|
|
|
+ // if (i != 'password') {
|
|
|
+ this.form[i] = data[i];
|
|
|
+ // }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.detailsInfo = data;
|
|
|
+
|
|
|
+ if (data.itemInfo) {
|
|
|
+ let list = data.itemInfo;
|
|
|
+ list.forEach(element => {
|
|
|
+ element.bigCount = element.bigNum;
|
|
|
+ element.smallCount = element.smallNum;
|
|
|
+ });
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: list });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!this.getMerchantInfo) {
|
|
|
+ await this.initMerchantInfo();
|
|
|
+ }
|
|
|
+ console.log(66666, this.getMerchantInfo);
|
|
|
+ } catch (error) {
|
|
|
+ console.log(4444, error);
|
|
|
}
|
|
|
- this.showRegion = true;
|
|
|
- },
|
|
|
- changeAreaFn(e) {
|
|
|
- console.log("changeAreaFn", e);
|
|
|
- this.form.address = e.address;
|
|
|
- this.region.lat = e.location.lat;
|
|
|
- this.region.long = e.location.lng;
|
|
|
},
|
|
|
+
|
|
|
changeCustomerFn(e) {
|
|
|
console.log("changeCustomerFn", e);
|
|
|
this.form.address = e.address;
|
|
|
this.form.lat = e.location.lat;
|
|
|
this.form.long = e.location.lng;
|
|
|
},
|
|
|
- // 省市联动
|
|
|
- openAddres() {
|
|
|
- this.$refs.simpleAddress.open();
|
|
|
- },
|
|
|
+
|
|
|
onCityConfirm(e) {
|
|
|
// this.form.receiveAddress = e.label
|
|
|
this.form.province = e.provinceName;
|
|
|
this.form.city = e.cityName;
|
|
|
// this.pickerText = JSON.stringify(e)
|
|
|
},
|
|
|
- confirmFn() {
|
|
|
- let hostFn = this.option.id ? update : add;
|
|
|
- if (this.option.id) {
|
|
|
- this.form.id = this.option.id;
|
|
|
- }
|
|
|
- hostFn(this.form).then(res => {
|
|
|
- let promptText = this.option.id ? "修改成功!" : "添加成功!";
|
|
|
- this.$msg(promptText);
|
|
|
- // uni.removeStorageSync("modifyShopB");
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$util.pageTo("/admin/shop/list");
|
|
|
- // }, 1000);
|
|
|
- });
|
|
|
+ async confirmFn() {
|
|
|
+ try {
|
|
|
+ const { orderSn } = this.option;
|
|
|
+ let formData = this.form;
|
|
|
+ if (orderSn) {
|
|
|
+ formData.orderSn = orderSn;
|
|
|
+ }
|
|
|
+ const itemInfo = this.selectList.map(ele => {
|
|
|
+ return {
|
|
|
+ productId: ele.id,
|
|
|
+ bigNum: ele.bigCount,
|
|
|
+ smallNum: ele.smallCount,
|
|
|
+ itemPrice: ele.itemPrice || this.getSelectItemPrice(ele)
|
|
|
+ };
|
|
|
+ });
|
|
|
+ formData.itemInfo = JSON.stringify(itemInfo);
|
|
|
+ if (!this.getMerchantInfo) {
|
|
|
+ await this.initMerchantInfo();
|
|
|
+ }
|
|
|
+ formData.supplierId = this.getMerchantInfo.id;
|
|
|
+ await createPurchaseOrderApi(formData);
|
|
|
+ this.$msg("确认成功!");
|
|
|
+
|
|
|
+ this.resetSelectInfoByType(this.pageType);
|
|
|
+ this.$util.pageTo({ url: "/pagesPurchase/result", type: 2 });
|
|
|
+ } catch (error) {}
|
|
|
},
|
|
|
// 表单验证
|
|
|
formSubmit(e) {
|
|
|
// 表单规则
|
|
|
let rules = [
|
|
|
{
|
|
|
- name: "shopName",
|
|
|
- rule: [""],
|
|
|
- msg: ["请输入名称"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "openTime",
|
|
|
- rule: [""],
|
|
|
- msg: ["请输入营业时间"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "telephone",
|
|
|
- rule: [""],
|
|
|
- msg: ["请输入联系电话"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "province",
|
|
|
- rule: [""],
|
|
|
- msg: ["请选择地址"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "address",
|
|
|
- rule: [""],
|
|
|
- msg: ["请填写详细地址"]
|
|
|
- },
|
|
|
- {
|
|
|
- name: "floor",
|
|
|
- rule: [""],
|
|
|
- msg: ["请输入门牌号"]
|
|
|
+ name: "itemInfo",
|
|
|
+ rule: ["minLength", 1],
|
|
|
+ msg: ["请选择花材"]
|
|
|
}
|
|
|
];
|
|
|
// 进行表单检查
|
|
|
let formData = this.form;
|
|
|
+ formData.itemInfo = this.selectList;
|
|
|
let checkRes = form.validation(formData, rules);
|
|
|
// 验证通过!
|
|
|
if (!checkRes) {
|
|
|
@@ -340,8 +376,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
gobackEvent() {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pagesPurchase/add",
|
|
|
+ success: result => {},
|
|
|
+ fail: () => {},
|
|
|
+ complete: () => {}
|
|
|
});
|
|
|
}
|
|
|
}
|