edit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <u-modal :show="show" :title="title" :showCancelButton="true" @cancel="hideModal" @confirm="confirmEdit">
  3. <view class="form-container">
  4. <u-form :model="info" ref="formRef" labelPosition="top">
  5. <u-form-item label="品牌" class="u-form-item-row" borderBottom @click="showBrandList" labelWidth="70">
  6. <Cell :val="info.dictLabel" :isDelete="true" @handleClear="clear('brand')"></Cell>
  7. <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
  8. </u-form-item>
  9. <u-form-item label="付款方式" borderBottom labelWidth="70">
  10. <TabSelect :tabList="paymentTabList" :echoInfo="info.payType"
  11. :colNum="3" mode="single"
  12. :isClear="payTypeIsClear" @tabChange="handlePayTypeTabChange">
  13. </TabSelect>
  14. </u-form-item>
  15. <u-form-item label="开单人" class="u-form-item-row" borderBottom labelWidth="70"
  16. @click="showRecyclePersonPicker">
  17. <Cell :val="info.recyclePerson" :isDelete="true" @handleClear="clear('recyclePerson')"></Cell>
  18. <PersonPicker ref="recyclePersonPickerRef" title="请选择回收人员"
  19. @selectPerson="handleSelectRecyclePerson">
  20. </PersonPicker>
  21. </u-form-item>
  22. <u-form-item label="开单数量" class="u-form-item-row" labelWidth="70" borderBottom>
  23. <u-number-box v-model="info.quantity" button-size="26"></u-number-box>
  24. </u-form-item>
  25. <u-form-item label="开单日期" class="u-form-item-row" labelWidth="70" borderBottom
  26. @click="showOrderDatePicker">
  27. <Cell :val="info.orderDate" :isDelete="true" @handleClear="clear('orderDate')"></Cell>
  28. <u-datetime-picker @confirm="confirmOrderDate" @close="closeOrderDatePicker"
  29. @cancel="closeOrderDatePicker" :show="orderDateShow" v-model="info.orderDate"
  30. mode="date"></u-datetime-picker>
  31. </u-form-item>
  32. <u-form-item label="订单类型" borderBottom labelWidth="70">
  33. <TabSelect :tabList="orderTypeList" :isClear="orderTypeIsClear" mode="single" :colNum="4"
  34. :echoInfo="info.orderType" labelKey="dictLabel" valueKey="dictValue"
  35. @tabChange="changeOrderType">
  36. </TabSelect>
  37. </u-form-item>
  38. <u-form-item label="商品分类" labelWidth="70" borderBottom>
  39. <TabSelect :tabList="typeList" :isClear="typeIsClear" @tabChange="handleTabChangeType"
  40. labelKey="dictLabel" valueKey="dictValue" :colNum="4" mode="single" :echoInfo="info.type">
  41. </TabSelect>
  42. </u-form-item>
  43. <u-form-item label="成交金额" class="u-form-item-row" labelWidth="70" borderBottom>
  44. ¥<u--input v-model="info.dealPrice" placeholder="成交金额" border="none" type="number"></u--input>元
  45. </u-form-item>
  46. <u-form-item label="实收总计" class="u-form-item-row" labelWidth="70" borderBottom>
  47. ¥<u--input v-model="info.amountReceived" placeholder="实收总计" border="none" type="number"></u--input>元
  48. </u-form-item>
  49. <u-form-item label="开单备注" labelWidth="70" borderBottom>
  50. <u--textarea v-model="info.orderRemark" clearable placeholder="备注" count autoHeight maxlength="50"
  51. height="100" confirmType="done"></u--textarea>
  52. </u-form-item>
  53. <u-form-item label="收货地址" labelWidth="70" borderBottom>
  54. <u--textarea v-model="info.address" clearable placeholder="收货地址" count autoHeight maxlength="50"
  55. height="100" confirmType="done"></u--textarea>
  56. </u-form-item>
  57. <u-form-item label="售后保障配置" labelWidth="100">
  58. <TabSelect :tabList="afterSaleTabList" :echoInfo="info.afterSaleTab" mode="multiple" :colNum="2"
  59. @tabChange="changeAfterSaleTab">
  60. </TabSelect>
  61. </u-form-item>
  62. <u-form-item label="支付凭证图片" labelWidth="100">
  63. <view class="imgs_scroll">
  64. <ImgsRowScroll :isShowDeleteIcon="true"
  65. @deleteImgInfo="getDeletePayTypeProofPicInfo" imgMode="aspectFill" :totalWidth="400"
  66. :images="info.payTypeProofPicFileList" :previewEnabled="true" :imageWidth="150" :imageHeight="150">
  67. </ImgsRowScroll>
  68. <u-upload @afterRead="afterReadPayTypeProofPic" name="1" multiple :maxCount="10"></u-upload>
  69. </view>
  70. </u-form-item>
  71. </u-form>
  72. </view>
  73. </u-modal>
  74. </template>
  75. <script>
  76. import { afterSaleTabList, paymentTabList } from '../../js/public.js'
  77. import Cell from '@/components/custom-cell/index.vue'
  78. import BrandList from '@/components/brand-list/index.vue'
  79. import TabSelect from '@/components/custom-tab-select/index.vue'
  80. import PersonPicker from '@/components/person-picker/index.vue'
  81. import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
  82. export default {
  83. name: 'OrderListEdit',
  84. components: {
  85. Cell,
  86. BrandList,
  87. TabSelect,
  88. PersonPicker,
  89. ImgsRowScroll
  90. },
  91. data() {
  92. return {
  93. show: false,
  94. info: {
  95. dictValue: '',
  96. dictLabel: '',
  97. payType: '',
  98. recyclePerson: '',
  99. recyclePersonId: '',
  100. quantity: 0,
  101. orderDate: this.$dayjs().format('YYYY-MM-DD'),
  102. orderType: '',
  103. type: '',
  104. dealPrice: 0,
  105. amountReceived: 0,
  106. orderRemark: '',
  107. address: '',
  108. afterSaleTab: [],
  109. },
  110. paymentTabList: paymentTabList,
  111. afterSaleTabList: afterSaleTabList,
  112. payTypeIsClear: true,
  113. orderTypeIsClear: true,
  114. typeIsClear: true,
  115. orderDateShow: false,
  116. orderTypeList: [],
  117. typeList: [],
  118. }
  119. },
  120. props: {
  121. title: {
  122. type: String,
  123. default: '编辑'
  124. },
  125. orderInfo: {
  126. type: Object,
  127. default: () => { }
  128. }
  129. },
  130. emits: ['confirm'],
  131. methods: {
  132. showModal() {
  133. this.getOrderTypeList();
  134. this.getTypeList();
  135. uni.$u.api.wareHouseOrderDetail({
  136. id: this.orderInfo.id
  137. }).then(res => {
  138. this.show = true;
  139. this.$nextTick(() => {
  140. this.info = res.data;
  141. this.info.payType = res.data.payType || '';
  142. this.info.orderDate = this.$dayjs(this.info.orderDate).format('YYYY-MM-DD');
  143. })
  144. })
  145. },
  146. hideModal() {
  147. this.show = false;
  148. this.info= {
  149. dictValue: '',
  150. dictLabel: '',
  151. payType: '',
  152. recyclePerson: '',
  153. recyclePersonId: '',
  154. quantity: 0,
  155. orderDate: '',
  156. orderType: '',
  157. type: '',
  158. dealPrice: 0,
  159. amountReceived: 0,
  160. orderRemark: '',
  161. address: '',
  162. afterSaleTab: [],
  163. }
  164. },
  165. confirmEdit() {
  166. uni.$u.api.wareHouseOrderUpdate({
  167. id: this.info.id,
  168. dictValue: this.info.dictValue,
  169. dictLabel: this.info.dictLabel,
  170. payType: this.info.payType,
  171. recyclePerson: this.info.recyclePerson,
  172. recyclePersonId: this.info.recyclePersonId,
  173. quantity: this.info.quantity,
  174. orderDate: this.info.orderDate,
  175. orderType: this.info.orderType,
  176. type: this.info.type,
  177. dealPrice: this.info.dealPrice,
  178. amountReceived: this.info.amountReceived,
  179. orderRemark: this.info.orderRemark,
  180. address: this.info.address,
  181. afterSaleTab: this.info.afterSaleTab,
  182. payTypeProofPicFileList: this.info.payTypeProofPicFileList,
  183. }).then(() => {
  184. uni.$u.toast('更新成功');
  185. this.$emit('confirm');
  186. this.hideModal();
  187. }).catch(err => {
  188. uni.$u.toast(err);
  189. })
  190. },
  191. showBrandList() {
  192. this.$refs.brandListRef.showBrandList();
  193. },
  194. handleSelectedBrand(info) {
  195. this.$set(this.info, 'dictLabel', info.dictLabel);
  196. this.$set(this.info, 'dictValue', info.dictValue);
  197. },
  198. handlePayTypeTabChange(e) {
  199. this.info.payType = e;
  200. },
  201. showRecyclePersonPicker() {
  202. this.$refs.recyclePersonPickerRef.open();
  203. },
  204. handleSelectRecyclePerson(info) {
  205. this.info.recyclePerson = info.label;
  206. this.info.recyclePersonId = info.id;
  207. },
  208. clear(field) {
  209. if (field === 'brand') {
  210. this.info.dictLabel = '';
  211. this.info.dictValue = '';
  212. }
  213. if (field === 'recyclePerson') {
  214. this.info.recyclePerson = '';
  215. this.info.recyclePersonId = '';
  216. }
  217. this.info[field] = '';
  218. },
  219. confirmOrderDate() {
  220. this.$nextTick(() => {
  221. this.info.orderDate = this.$dayjs(this.info.orderDate).format('YYYY-MM-DD');
  222. this.orderDateShow = false;
  223. })
  224. },
  225. showOrderDatePicker() {
  226. this.$nextTick(() => {
  227. this.orderDateShow = true;
  228. })
  229. },
  230. closeOrderDatePicker() {
  231. this.orderDateShow = false;
  232. },
  233. getOrderTypeList() {
  234. this.$getDicts("crm_sendOrder_type").then(res => {
  235. this.orderTypeList = res
  236. })
  237. },
  238. getTypeList() {
  239. this.$getDicts("crm_form_category").then(res => {
  240. this.typeList = res
  241. })
  242. },
  243. changeOrderType(val) {
  244. this.info.orderType = val
  245. },
  246. handleTabChangeType(e) {
  247. this.info.type = e;
  248. },
  249. changeAfterSaleTab(val) {
  250. this.info.afterSaleTab = val
  251. },
  252. getDeletePayTypeProofPicInfo(info) {
  253. this.openOrderForm.payTypeProofPicFileList = info.newImages
  254. },
  255. afterReadPayTypeProofPic(event) {
  256. event.file.forEach(item => {
  257. uni.$u.api.uploadFile(item.url).then((res) => {
  258. this.info.payTypeProofPicFileList.push(res.data.url);
  259. uni.$u.toast("文件上传成功");
  260. }).catch(() => {
  261. uni.$u.toast("上传文件失败");
  262. })
  263. })
  264. },
  265. }
  266. }
  267. </script>
  268. <style lang="scss" scoped>
  269. @import '../../styles/orderList/edit.scss';
  270. </style>