吉福庄APP,基于若依原版开发
wangzhenxin
2024-05-01 5fc317563ff70537ec64236466c28a665bead905
成本计算开发
2 files modified
40 ■■■■■ changed files
api/calc/food.js 19 ●●●●● patch | view | raw | blame | history
pages/calc/food/calc.vue 21 ●●●●● patch | view | raw | blame | history
api/calc/food.js
@@ -1,27 +1,10 @@
import request from '@/utils/request'
// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}
// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}
// 计算产品成本
export function getFoodMaterialCostList(data) {
  return request({
    url: '/jfz/material/calc',
    method: 'put',
    method: 'post',
    data: data
  })
}
pages/calc/food/calc.vue
@@ -1,8 +1,8 @@
<template>
  <view class="container">
    <view class="example">
        <uni-collapse ref="collapse" v-model="value" @change="change">
            <uni-collapse-item title="产品数量" >
        <uni-collapse ref="collapse" v-model="value">
            <uni-collapse-item title="产品数量" name="0" >
                <view class="content">
                    <uni-forms ref="form" labelWidth="100px" v-for="food in foods">
                      <uni-forms-item :label="food.name" :name="food.code">
@@ -12,9 +12,15 @@
                    <button type="primary" @click="submit">开始测算</button>
                </view>
            </uni-collapse-item>
            <uni-collapse-item title="计算结果">
                <view class="content">
                    <text class="text">折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段文字。再次点击标题,折叠内容。</text>
            <uni-collapse-item title="计算结果" name="1">
                <view class="content" v-for="res in calcResult">
                    <uni-section :title="res.maTypeName" type="line">
                        <uni-list v-for="m in res.materialList">
                            <uni-list-item :title="m.maName" :note="'数量:'+m.qty+m.unit+'  成本:'+m.amount+'元'"
                                                thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
                                                thumb-size="sm" rightText="" />
                        </uni-list>
                    </uni-section>
                </view>
            </uni-collapse-item>
        </uni-collapse>
@@ -38,7 +44,7 @@
            { code:'A0006',name: '爆辣鸡腿卷饼',qty: 0 },
            { code:'A0007',name: '藤椒鸡腿卷饼',qty: 0 },
        ],
        calcResult:{},
        rules: {
          nickName: {
            rules: [{
@@ -73,7 +79,8 @@
    methods: {
      submit(ref) {
        getFoodMaterialCostList(this.foods).then(response => {
            this.$modal.msgSuccess("修改成功")
            this.calcResult = response.data;
            this.value = ['1'];
          })
      }
    }