index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="form-container">
  4. <view class="item">
  5. <view class="label"><text>*</text>客户电话</view>
  6. <u--input :maxlength="11" placeholder="请输入" border="none" inputAlign="right" v-model="userMobile"></u--input>
  7. </view>
  8. <view class="item">
  9. <view class="label"><text>*</text>工单单号</view>
  10. <u--input :readonly="hasOid" placeholder="请输入" border="none" inputAlign="right" v-model="orderNo"></u--input>
  11. </view>
  12. <view class="item" @tap="hasOid ? '' : (isShowWebsitDialog = true)">
  13. <view class="label"><text>*</text>所属网点</view>
  14. <view class="picker">
  15. <text class="value" v-if="websit">{{ websit.name }}</text>
  16. <text class="placeholder" v-else>请选择工单所属网点</text>
  17. <text class="iconfont icon-jinru"></text>
  18. </view>
  19. </view>
  20. <!-- ------------------------------------ -->
  21. <view v-for="(item, index) in rpMaterialOrderItemList" :key="index">
  22. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  23. <view class="item">
  24. <view class="label" style="font-weight: bold">配件信息{{ index + 1 }}</view>
  25. <view class="label" style="color: red; margin-right: 10rpx" @click="delpeijian(index)">删除</view>
  26. </view>
  27. <view class="item">
  28. <view class="label"><text>*</text>维修标识</view>
  29. <radio-group
  30. @change="
  31. d => {
  32. item.repairFlag = d.detail.value
  33. }
  34. "
  35. >
  36. <label style="margin-right: 20upx">
  37. <radio value="INNER" :checked="item.repairFlag === 'INNER'" />保内
  38. </label>
  39. <label> <radio value="OUTSIDE" :checked="item.repairFlag === 'OUTSIDE'" />保外 </label>
  40. </radio-group>
  41. </view>
  42. <view class="item">
  43. <view class="label"><text>*</text>旧配件编号</view>
  44. <u--input placeholder="请输入" border="none" inputAlign="right" v-model="item.oldPartsNumber"></u--input>
  45. </view>
  46. <view class="item">
  47. <view class="label"><text>*</text>旧配件名称</view>
  48. <u--input placeholder="请输入" border="none" inputAlign="right" v-model="item.oldPartsName"></u--input>
  49. </view>
  50. <view class="item" @tap="toChooseProduct(index)">
  51. <view class="label"><text>*</text>新配件名称</view>
  52. <view class="picker">
  53. <text class="value" v-if="item">{{ item.goodsName }}</text>
  54. <text class="placeholder" v-else>选择产品</text>
  55. <text class="iconfont icon-jinru"></text>
  56. </view>
  57. </view>
  58. <view class="item">
  59. <view class="label"><text>*</text>新配件编号</view>
  60. <u--input
  61. :disabled="true"
  62. :readonly="true"
  63. placeholder="请输入"
  64. border="none"
  65. inputAlign="right"
  66. v-model="item.goodsCode"
  67. ></u--input>
  68. </view>
  69. </view>
  70. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  71. <u-button class="btnloukong" text="添加配件" @click="addpeijian"></u-button>
  72. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  73. </view>
  74. <template slot="footer">
  75. <view class="footer-btn-group">
  76. <!-- <u-button
  77. text="历史记录"
  78. @click="$navToPage({ url: `/packageMaterial/pages/newSale/orderList?type=${type}` })"
  79. ></u-button> -->
  80. <u-button type="primary" text="提交" @click="submitData"></u-button>
  81. </view>
  82. </template>
  83. <zjDialogPicker
  84. ref="websitDialog"
  85. :isShow="isShowWebsitDialog"
  86. :multiple="false"
  87. :styleType="2"
  88. :title="'所属网点'"
  89. :list="websitList"
  90. :keyName="'name'"
  91. @cancel="isShowWebsitDialog = false"
  92. @confirm="confirmWebsitDialog"
  93. >
  94. </zjDialogPicker>
  95. </zj-page-layout>
  96. </template>
  97. <script>
  98. import zjDialogPicker from '@/components/zj-dialog/zj-dialog-picker.vue'
  99. export default {
  100. components: {
  101. zjDialogPicker
  102. },
  103. data() {
  104. return {
  105. hasOid: false,
  106. wbId: null, // 维保工单
  107. wbIsAllFee: null, // 维保工单是否包含全部费用
  108. wbPayType: null, // 维保工单费用支付方式
  109. type: 'M',
  110. userMobile: '',
  111. orderNo: '',
  112. salesType: 'OUT',
  113. brand: null,
  114. brandList: [],
  115. isShowBrandDialog: false,
  116. category: null,
  117. categoryList: [],
  118. isShowCategoryDialog: false,
  119. websit: null,
  120. websitList: [],
  121. isShowWebsitDialog: false,
  122. rpMaterialOrderItemList: []
  123. }
  124. },
  125. onLoad({ type, oid = '' }) {
  126. this.type = type
  127. this.hasOid = oid.length > 0
  128. uni.setNavigationBarTitle({
  129. title: '配件收款'
  130. })
  131. this.getWebsitList(() => {
  132. if (this.hasOid) {
  133. this.$api
  134. .post('/pg/order/base/detail', {
  135. orderBaseId: oid
  136. })
  137. .then(res => {
  138. console.log(res.data)
  139. const data = res.data
  140. this.orderNo = oid
  141. this.userMobile = data.userMobile
  142. this.websit = this.websitList.find(item => item.websitId == data.websitId) || {}
  143. if (data.pgOrderProducts && data.pgOrderProducts.length > 0) {
  144. this.brand = {
  145. id: data.pgOrderProducts[0].brandId,
  146. brandName: data.pgOrderProducts[0].brandName
  147. }
  148. }
  149. this.wbId = data.rpProjectRepairId || ''
  150. this.wbIsAllFee = data.isAllFee || ''
  151. this.wbPayType = data.feePayMethod || ''
  152. })
  153. }
  154. })
  155. },
  156. onShow() {
  157. var data = this.$getStorage('materialSaleData')
  158. if (data.dijiIndex !== undefined && this.rpMaterialOrderItemList[Number(data.dijiIndex)]) {
  159. this.rpMaterialOrderItemList.splice(Number(data.dijiIndex), 1, {
  160. ...this.rpMaterialOrderItemList[Number(data.dijiIndex)],
  161. goodsAmount: data.goodsAmount,
  162. goodsCode: data.goodsCode,
  163. goodsId: data.goodsId,
  164. goodsName: data.goodsName,
  165. unit: data.goodsUnit,
  166. num: data.num
  167. })
  168. }
  169. this.$removeStorage('materialSaleData')
  170. },
  171. methods: {
  172. addpeijian() {
  173. this.rpMaterialOrderItemList.push({
  174. goodsAmount: '',
  175. goodsCode: '',
  176. goodsId: '',
  177. goodsName: '',
  178. unit: '',
  179. num: '',
  180. oldPartsName: '',
  181. oldPartsNumber: '',
  182. repairFlag: ''
  183. })
  184. },
  185. delpeijian(index) {
  186. this.rpMaterialOrderItemList.splice(index, 1)
  187. },
  188. getWebsitList(cb) {
  189. this.$api.get('/user/apply/websit').then(res => {
  190. this.websitList = res.data
  191. if (this.websitList.length == 1) {
  192. this.websit = this.websitList[0]
  193. }
  194. cb?.()
  195. })
  196. },
  197. confirmWebsitDialog(e) {
  198. this.websit = this.websitList[e[0]]
  199. this.isShowWebsitDialog = false
  200. },
  201. toChooseProduct(index) {
  202. if (!this.websit) return this.$toast('请选择所属网点')
  203. this.$navToPage({
  204. url: `/packageMaterial/pages/newSale/product?dijiIndex=${index}&type=${this.type}&categoryId=${
  205. this.type == 'P' ? this?.category?.categoryId : ''
  206. }&categoryName=${this.type == 'P' ? this?.category?.name : ''}&userMobile=${this.userMobile}&orderNo=${
  207. this.orderNo
  208. }&partsWebsitId=${this.websit.partsWebsitId}&websitId=${this.websit.websitId}&websitName=${
  209. this.websit.name
  210. }&wbId=${this.wbId || ''}&wbIsAllFee=${this.wbIsAllFee || ''}&wbPayType=${this.wbPayType || ''}`
  211. })
  212. },
  213. submitData() {
  214. if (!this.userMobile) return this.$toast('请输入客户电话')
  215. if (this.rpMaterialOrderItemList.length < 1) return this.$toast('请选择')
  216. for (var item of this.rpMaterialOrderItemList) {
  217. if (!item.repairFlag) return this.$toast('维修标识不能为空')
  218. if (!item.oldPartsNumber) return this.$toast('旧配件编号不能为空')
  219. if (!item.oldPartsName) return this.$toast('旧配件名称不能为空')
  220. if (!item.goodsName) return this.$toast('新配件名称不能为空')
  221. if (!item.goodsCode) return this.$toast('新配件编号不能为空')
  222. }
  223. if (!this.orderNo) return this.$toast('请填写工单号')
  224. this.$setStorage('materialSaleDataZhiFu', {
  225. type: this.type,
  226. categoryId: this.type == 'P' ? this?.category?.categoryId : '',
  227. categoryName: this.type == 'P' ? this?.category?.name : '',
  228. salesType: 'OUT',
  229. brandId: null,
  230. brandName: null,
  231. websitId: this.websit.websitId,
  232. websitName: this.websit.name,
  233. userMobile: this.userMobile,
  234. orderNo: this.orderNo,
  235. wbId: this.wbId,
  236. wbIsAllFee: this.wbIsAllFee,
  237. wbPayType: this.wbPayType,
  238. goodsList: this.rpMaterialOrderItemList
  239. })
  240. this.$navToPage({
  241. url: `/packageMaterial/pages/newSale/order`
  242. })
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .form-container {
  249. background: #ffffff;
  250. margin-top: 20rpx;
  251. border-top: 1px solid #f5f5f5;
  252. .btnloukong {
  253. height: 72rpx;
  254. border: 2rpx solid #005ef4;
  255. margin: 0;
  256. background: transparent;
  257. font-size: 28rpx;
  258. line-height: 72rpx;
  259. color: #0268fa;
  260. }
  261. .item {
  262. height: 108rpx;
  263. border-bottom: 1px solid #f5f5f5;
  264. display: flex;
  265. align-items: center;
  266. justify-content: space-between;
  267. padding: 0 20rpx;
  268. .label {
  269. margin-right: 30rpx;
  270. text {
  271. color: $error-color;
  272. }
  273. }
  274. .picker {
  275. .placeholder {
  276. color: $sec-font;
  277. }
  278. .iconfont {
  279. margin-left: 12rpx;
  280. color: $sec-font;
  281. }
  282. }
  283. ::v-deep .u-radio-group {
  284. flex: unset;
  285. .u-radio {
  286. margin-left: 50rpx;
  287. }
  288. }
  289. }
  290. }
  291. </style>