add.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="app-content">
  3. <form @submit="commitForm">
  4. <view class="module-com input-line-wrap">
  5. <tui-list-cell class="line-cell" :hover="false">
  6. <view class="tui-title required">店名</view>
  7. <input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="店名、姓名或公司名" maxlength="50" type="text" />
  8. </tui-list-cell>
  9. <tui-list-cell class="line-cell" :hover="false">
  10. <view class="tui-title">手机号</view>
  11. <input v-model="form.mobile" placeholder-class="phcolor" class="tui-input" name="mobile" placeholder="对方手机号" maxlength="50" type="text" />
  12. </tui-list-cell>
  13. <tui-list-cell class="line-cell" :hover="false">
  14. <view class="tui-title">微信号</view>
  15. <input v-model="form.wx" placeholder-class="phcolor" class="tui-input" name="wx" placeholder="对方微信号" maxlength="50" type="text" />
  16. </tui-list-cell>
  17. <tui-list-cell class="line-cell" :hover="false">
  18. <view class="tui-title">身份证号</view>
  19. <input v-model="form.no" placeholder-class="phcolor" class="tui-input" name="no" placeholder="对方身份证号或营业执照号" maxlength="50" type="text" />
  20. </tui-list-cell>
  21. <tui-list-cell class="line-cell" :hover="false">
  22. <view class="tui-title required">欠款日期</view>
  23. <input v-model="form.date" placeholder-class="phcolor" class="tui-input" name="date" placeholder="选账单交易日期" maxlength="50" type="text" />
  24. </tui-list-cell>
  25. <tui-list-cell class="line-cell" :hover="false">
  26. <view class="tui-title required">欠款金额</view>
  27. <input v-model="form.amount" placeholder-class="phcolor" class="tui-input" name="amount" placeholder="对方欠款金额" maxlength="50" type="digit" />
  28. </tui-list-cell>
  29. </view>
  30. <view class="module-com input-line-wrap goods-wrap">
  31. <view class="module-tit">
  32. <span>图片证据</span>
  33. <span class="app-color-3">(微信聊天截图、销售单拍照等,最多5张)</span>
  34. </view>
  35. <view class="module-det">
  36. <htz-image-upload :max="5" :compress="true" v-model="currentImgData" :headers="headers"
  37. @uploadSuccess="imgUploadSuccess" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
  38. </htz-image-upload>
  39. </view>
  40. </view>
  41. <view class="module-com input-line-wrap summary-wrap">
  42. <view class="module-tit">其他说明</view>
  43. <view class="module-det" style="padding-bottom: 20upx">
  44. <textarea v-model="form.briefContent" class="goods-summary" placeholder-class="phcolor" placeholder="补充说明" />
  45. </view>
  46. </view>
  47. <view class="app-footer">
  48. <button class="admin-button-com middle default" @click="goBack">取消</button>
  49. <button class="admin-button-com middle blue" formType="submit">保存</button>
  50. </view>
  51. </form>
  52. </view>
  53. </template>
  54. <script>
  55. import { mapGetters } from "vuex";
  56. import TuiListCell from "@/components/plugin/list-cell";
  57. import AppUploader from "@/components/app-uploader";
  58. const form = require("@/utils/formValidation.js");
  59. import { addGoodsData } from "@/api/goods"
  60. import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
  61. export default {
  62. name: "add",
  63. components: { TuiListCell, AppUploader,htzImageUpload },
  64. mixins: [],
  65. data() {
  66. return {
  67. headers:{token:''},
  68. form: {
  69. name: "",
  70. wx:"",
  71. mobile:"",
  72. amount: "",
  73. date:"",
  74. no:""
  75. },
  76. currentImgData:[]
  77. };
  78. },
  79. onLoad() {
  80. const token = uni.getStorageSync('token')
  81. this.headers.token = token
  82. },
  83. methods: {
  84. goBack(){
  85. uni.navigateBack({delta:1})
  86. },
  87. imgDeleteFn(res){
  88. const index = res.index
  89. this.form.shopImg.splice(index,1)
  90. },
  91. imgUploadSuccess(res) {
  92. var _res = JSON.parse(res.data)
  93. if(_res.code == 1){
  94. this.currentImgData.push(_res.data.smallUrl)
  95. this.form.shopImg.push(_res.data.shortUrl)
  96. }
  97. },
  98. init() {
  99. },
  100. confirmFn() {
  101. let that = this
  102. if (this.$util.isEmpty(this.form.shopImg)) {
  103. this.$msg("请上传图片");
  104. return false;
  105. }
  106. this.form.cover = this.form.shopImg[0]
  107. that.$util.confirmModal({content:'确认添加?提交后不可修改'},() => {
  108. uni.showLoading({mask:true})
  109. let form = JSON.parse(JSON.stringify(this.form));
  110. addGoodsData({...form,itemList:JSON.stringify(product) }).then(res => {
  111. uni.hideLoading()
  112. this.$msg("添加成功")
  113. setTimeout(function(){
  114. uni.navigateBack({})
  115. },1500)
  116. })
  117. })
  118. },
  119. commitForm(e) {
  120. this.confirmFn()
  121. }
  122. }
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .app-content {
  127. min-height: calc(100vh - 100upx);
  128. padding-bottom: 100upx;
  129. }
  130. .module-com {
  131. margin-bottom: 20upx;
  132. background-color: #fff;
  133. color: $fontColor2;
  134. .module-tit {
  135. padding: 20upx 30upx;
  136. font-size: 28upx;
  137. }
  138. .module-det {
  139. padding: 0 30upx;
  140. }
  141. }
  142. .category-wrap {
  143. align-items: flex-start;
  144. padding-bottom: 0 !important;
  145. .tui-input {
  146. @include disFlex(center, flex-start);
  147. flex-wrap: wrap;
  148. .admin-button-com {
  149. margin-right: 20upx;
  150. margin-bottom: 20upx;
  151. position: relative;
  152. z-index: 9999;
  153. }
  154. }
  155. }
  156. .summary-wrap {
  157. .goods-summary {
  158. height: 200upx;
  159. }
  160. }
  161. .app-footer {
  162. justify-content: space-evenly;
  163. z-index: 9999;
  164. .admin-button-com {
  165. width: 46%;
  166. padding-top:30upx;
  167. padding-bottom:30upx;
  168. }
  169. }
  170. .commodity-view {
  171. display: flex;
  172. flex-direction: column;
  173. .commodity-list {
  174. padding: 25upx;
  175. .commodity-item {
  176. display: flex;
  177. margin-bottom: 20upx;
  178. .item-icon {
  179. flex-shrink: 0;
  180. width: 120upx;
  181. height: 120upx;
  182. }
  183. .item-info {
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: center;
  187. flex: 1;
  188. margin-left: 20upx;
  189. .info-line {
  190. margin-bottom: 20upx;
  191. display: flex;
  192. justify-content: space-between;
  193. align-items: flex-end;
  194. .item-name {
  195. color: black;
  196. font-size: 30upx;
  197. font-weight: 700;
  198. overflow: hidden;
  199. white-space: nowrap;
  200. text-overflow: ellipsis;
  201. width:360upx;
  202. }
  203. .item-price {
  204. padding-right:30upx;
  205. color: #333;
  206. .price {
  207. font-size: 28upx;
  208. }
  209. }
  210. .item-type {
  211. color: #999;
  212. font-size: 24upx;
  213. }
  214. .item-count {
  215. color: #666;
  216. font-size: 24upx;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. .summary-bar {
  223. padding: 0 20upx;
  224. height: 90upx;
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. border-top: 1px solid #eeeeee;
  229. .operate-view {
  230. display: flex;
  231. align-items: center;
  232. color: #3385ff;
  233. font-size: 26upx;
  234. .iconfont {
  235. margin-right: 20upx;
  236. font-size: 40upx;
  237. }
  238. }
  239. .describe-view {
  240. display: flex;
  241. align-items: center;
  242. color: #333;
  243. font-size: 24upx;
  244. .price {
  245. font-weight: bold;
  246. font-size: 30upx;
  247. }
  248. }
  249. }
  250. }
  251. .infoAEdit {
  252. display: flex;
  253. justify-content: space-between;
  254. height: 60upx;
  255. line-height: 80upx;
  256. font-size: 28;
  257. font-weight: 700;
  258. color: #666;
  259. padding: 0 20upx;
  260. .iconfont {
  261. margin-right: 15upx;
  262. font-size: 30upx;
  263. }
  264. & > .editFlr {
  265. position: relative;
  266. color: #1890f3;
  267. font-size: 26upx;
  268. &:after {
  269. content: "";
  270. position: absolute;
  271. left: 0;
  272. top: 0;
  273. }
  274. }
  275. }
  276. </style>