auxiliarySalesOrderDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <div class="s-page">
  3. <el-page-header @back="goBack" :content="title"></el-page-header>
  4. <el-divider></el-divider>
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>单据信息</span>
  8. </div>
  9. <div class="mymain-container">
  10. <el-form ref="formData" :rules="rules" :model="formData" label-width="110px" size="small" label-position="left">
  11. <el-row :gutter="20" justify="start">
  12. <el-col :span="12">
  13. <el-form-item label="所属商户" :required="true" >
  14. <el-input type="text" :value="companyName" disabled></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="12">
  18. <el-form-item label="网点名称" prop="websitId" :required="true">
  19. <el-select v-model="formData.websitId" @change="changeWebsit" placeholder="请选择" style="width: 100%;">
  20. <el-option
  21. v-for="item in websitList"
  22. :key="item.websitId"
  23. :label="item.name"
  24. :value="item.websitId">
  25. </el-option>
  26. </el-select>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="8">
  30. <el-form-item label="师傅姓名" prop="worker" :required="true">
  31. <el-select v-model="formData.worker" @focus="()=>{
  32. if(!this.formData.websitId){return this.$message.warning('请先选择网点名称!');}
  33. }" filterable @change="changeWorker" @blur="workerBlur" placeholder="请选择" style="width: 100%;">
  34. <el-option
  35. v-for="item in workerList"
  36. :key="item.id"
  37. :label="item.nickName"
  38. :value="item.nickName">
  39. </el-option>
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="8">
  44. <el-form-item label="师傅身份证" prop="idcard" :required="true">
  45. <el-input type="text" v-model="formData.idcard" placeholder="请输入"></el-input>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="8">
  49. <el-form-item label="师傅联系电话" prop="phone" :required="true">
  50. <el-input type="text" v-model="formData.phone" placeholder="请输入"></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="12">
  54. <el-form-item label="订单来源" prop="source" :required="true">
  55. <el-select v-model="formData.source" placeholder="请选择" style="width: 100%;">
  56. <el-option
  57. v-for="item in [{name: '在线订单',id: 'ONLINE'},{name: '自建订单',id: 'SELF'}]"
  58. :key="item.workerId"
  59. :label="item.name"
  60. :value="item.workerId">
  61. </el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="9">
  66. <el-form-item label="支付方式" prop="payType" :required="true">
  67. <el-select v-model="formData.payType" placeholder="请选择" style="width: 100%;">
  68. <el-option
  69. v-for="item in [{name: '现金',id: 'CASH'},{name: '微信',id: 'WECHAT'}]"
  70. :key="item.id"
  71. :label="item.name"
  72. :value="item.id">
  73. </el-option>
  74. </el-select>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="3" v-if="formData.payType == 'WECHAT'">
  78. <div style="height: 32px;display: flex;align-items: center;cursor: pointer;">微信支付<i class="el-icon-full-screen"></i></div>
  79. </el-col>
  80. <el-col :span="24">
  81. <el-form-item label="备注">
  82. <el-input type="textarea" :rows="4" v-model="formData.remark" placeholder="请输入"></el-input>
  83. </el-form-item>
  84. </el-col>
  85. </el-row>
  86. </el-form>
  87. </div>
  88. </el-card>
  89. <el-card class="box-card">
  90. <div slot="header" class="clearfix">
  91. <span>辅材信息</span>
  92. </div>
  93. <el-button size="small" type="primary" @click="add()">添加</el-button>
  94. <div class="table">
  95. <el-table :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  96. <el-table-column label="大类名称" align="center">
  97. <template slot-scope="scope">
  98. <el-select v-model="scope.row.productCategory" value-key="categoryId" @change="changeMain" :disabled="isEdit != scope.$index" placeholder="请选择" style="width: 100%;">
  99. <el-option
  100. v-for="item in mainList"
  101. :key="item.categoryId"
  102. :label="item.categoryName"
  103. :value="item">
  104. </el-option>
  105. </el-select>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="小类名称" align="center">
  109. <template slot-scope="scope">
  110. <el-select v-model="scope.row.goodsCategory" @change="changeSmall" @focus="()=>{
  111. if(!scope.row.productCategory){return this.$message.warning('请先选择大类!');}
  112. }" :disabled="isEdit != scope.$index" value-key="categoryId" placeholder="请选择" style="width: 100%;">
  113. <el-option
  114. v-for="item in smallList"
  115. :key="item.categoryId"
  116. :label="item.categoryName"
  117. :value="item">
  118. </el-option>
  119. </el-select>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="辅材名称" align="center">
  123. <template slot-scope="scope">
  124. <el-select v-model="scope.row.goodsId" :disabled="isEdit != scope.$index" placeholder="请选择" style="width: 100%;">
  125. <el-option
  126. v-for="item in materialsList"
  127. :key="item.id"
  128. :label="item.name"
  129. :value="item.id">
  130. </el-option>
  131. </el-select>
  132. </template>
  133. </el-table-column>
  134. <el-table-column prop="goodsSalesUnit" align="center" label="单位" ></el-table-column>
  135. <el-table-column prop="" align="center" label="数量" >
  136. <template slot-scope="scope">
  137. <el-input type="number" v-model="scope.row.salesQty" :disabled="isEdit != scope.$index" placeholder="请输入"></el-input>
  138. </template>
  139. </el-table-column>
  140. <el-table-column prop="" align="center" label="商品代码"></el-table-column>
  141. <el-table-column prop="" align="center" label="规格型号"></el-table-column>
  142. <el-table-column prop="" align="center" label="销售价格"></el-table-column>
  143. <el-table-column prop="" align="center" label="销售金额"></el-table-column>
  144. <el-table-column prop="" align="center" label="库存数量"></el-table-column>
  145. <el-table-column label="操作" align="right" width="140">
  146. <template slot-scope="scope">
  147. <el-button size="mini" type="primary" v-if="scope.$index != isEdit" @click="isEdit = scope.$index">编辑</el-button>
  148. <el-button size="mini" type="danger" @click="dataList.splice(scope.$index,1)">删除</el-button>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. </div>
  153. </el-card>
  154. <div class="page-footer">
  155. <div class="footer">
  156. <el-button v-if="true" size="small" type="primary" @click="confirm()">提交</el-button>
  157. <el-button v-if="true" size="small" type="danger">确认收货</el-button>
  158. <el-button size="small" type="info" @click="goBack">返回</el-button>
  159. </div>
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import { getWebsit } from "@/api/customerManagement";
  165. import { getWorker, getCategory, getGoods } from "@/api/auxiliaryFittings/auxiliarySalesOrder";
  166. export default {
  167. props: ['id','title'],
  168. data() {
  169. return {
  170. dataList: [],
  171. websitList: [],
  172. workerList: [],
  173. mainList: [],
  174. smallList: [],
  175. materialsList: [],
  176. formData: {
  177. websitId: '',
  178. worker: '',
  179. idcard: '',
  180. phone: '',
  181. source: ''
  182. },
  183. productCategory: {},
  184. goodsCategory: {},
  185. isEdit: 0,
  186. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  187. rules: {
  188. websitId: [
  189. { required: true, message: '请选择网点', trigger: 'change' }
  190. ],
  191. worker: [
  192. { required: true, message: '请选择师傅', trigger: 'change' }
  193. ],
  194. source: [
  195. { required: true, message: '请选择订单来源', trigger: 'change' }
  196. ],
  197. payType: [
  198. { required: true, message: '请选择订单来源', trigger: 'change' }
  199. ],
  200. idcard: [
  201. { required: true, message: '请输入师傅身份证', trigger: 'blur' },
  202. ],
  203. phone: [
  204. { required: true, message: '请输入师傅联系电话', trigger: 'blur' },
  205. ],
  206. }
  207. };
  208. },
  209. computed: {},
  210. created() {
  211. this.getWebsit()
  212. },
  213. methods: {
  214. // 返回
  215. goBack() {
  216. this.$emit('back');
  217. },
  218. getWebsit(){
  219. getWebsit().then(res => {
  220. this.websitList = res.data
  221. })
  222. },
  223. changeWebsit(websitId){
  224. this.getWorker()
  225. getCategory({websitId}).then(res => {
  226. this.mainList = res.data
  227. })
  228. },
  229. getWorker(name){
  230. const that = this
  231. getWorker({pageNum: 1,pageSize: -1,params: [{param: 'a.nick_name',compare: '=',value: name},{param: 'b.websit_id',compare: '=',value: this.formData.websitId}]}).then(res => {
  232. if(name){
  233. that.formData.idcard = res.data.records[0].idCard
  234. that.formData.phone = res.data.records[0].mobile
  235. }else{
  236. this.workerList = res.data.records
  237. }
  238. })
  239. },
  240. changeWorker(e){
  241. this.getWorker(e)
  242. },
  243. workerBlur(e){
  244. this.formData.worker = e.target.value
  245. this.$forceUpdate()
  246. },
  247. changeMain(e){
  248. this.dataList[this.isEdit].goodsCategoryId = ''
  249. this.dataList[this.isEdit].goodsCategoryName = ''
  250. this.dataList[this.isEdit].goodsCategory = {}
  251. this.dataList[this.isEdit].parentCategoryId = e.categoryId
  252. this.dataList[this.isEdit].parentCategoryName = e.categoryName
  253. this.smallList = e.items
  254. },
  255. changeSmall(e){
  256. this.dataList[this.isEdit].goodsCategoryId = e.categoryId
  257. this.dataList[this.isEdit].goodsCategoryName = e.categoryName
  258. getGoods({websitId: this.formData.websitId,categoryId: e.categoryId,type: 'M',goodsName: e.categoryName}).then(res => {
  259. })
  260. },
  261. add(){
  262. this.dataList.push({
  263. productCategory: {},
  264. parentCategoryId: '',
  265. parentCategoryName: '',
  266. goodsCategory: {},
  267. goodsCategoryName: '',
  268. goodsCategoryId: '',
  269. goodsSalesUnit: '',
  270. salesQty: '',
  271. goodsId: '',
  272. goodsSpecification: '',
  273. saleAmount: ''
  274. })
  275. }
  276. }
  277. };
  278. </script>
  279. <style scoped="scoped" lang="scss">
  280. .s-page {
  281. padding: 20px;
  282. background-color: #ffffff;
  283. }
  284. .page-footer {
  285. height: 70px;
  286. }
  287. .footer {
  288. position: fixed;
  289. bottom: 0;
  290. left: 0;
  291. z-index: 1;
  292. width: 100%;
  293. background: #fff;
  294. padding: 15px 40px;
  295. box-sizing: border-box;
  296. transition: all 0.28s;
  297. text-align: right;
  298. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  299. &.hideSidebar {
  300. margin-left: 54px;
  301. width: calc(100vw - 54px);
  302. }
  303. &.openSidebar {
  304. margin-left: 210px;
  305. width: calc(100vw - 210px);
  306. }
  307. .tips {
  308. font-size: 12px;
  309. color: red;
  310. margin-top: 10px;
  311. }
  312. }
  313. </style>